Buckets:
| import { OAuth2Client, CodeChallengeMethod } from "../client.js"; | |
| const authorizationEndpoint = "https://twitter.com/i/oauth2/authorize"; | |
| const tokenEndpoint = "https://api.twitter.com/2/oauth2/token"; | |
| const tokenRevocationEndpoint = "https://api.twitter.com/2/oauth2/revoke"; | |
| export class Twitter { | |
| client; | |
| constructor(clientId, clientSecret, redirectURI) { | |
| this.client = new OAuth2Client(clientId, clientSecret, redirectURI); | |
| } | |
| createAuthorizationURL(state, codeVerifier, scopes) { | |
| const url = this.client.createAuthorizationURLWithPKCE(authorizationEndpoint, state, CodeChallengeMethod.S256, codeVerifier, scopes); | |
| return url; | |
| } | |
| async validateAuthorizationCode(code, codeVerifier) { | |
| const tokens = await this.client.validateAuthorizationCode(tokenEndpoint, code, codeVerifier); | |
| return tokens; | |
| } | |
| async refreshAccessToken(refreshToken) { | |
| const tokens = await this.client.refreshAccessToken(tokenEndpoint, refreshToken, []); | |
| return tokens; | |
| } | |
| async revokeToken(token) { | |
| await this.client.revokeToken(tokenRevocationEndpoint, token); | |
| } | |
| } | |
Xet Storage Details
- Size:
- 1.14 kB
- Xet hash:
- 0f6db9450f639a5a9cf72261e42ce55d48a63b9cbb5c4b3248acf83292051934
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.