download
raw
1.14 kB
import { OAuth2Client, CodeChallengeMethod } from "../client.js";
const authorizationEndpoint = "https://accounts.google.com/o/oauth2/v2/auth";
const tokenEndpoint = "https://oauth2.googleapis.com/token";
const tokenRevocationEndpoint = "https://oauth2.googleapis.com/revoke";
export class Google {
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:
0110b032a03b4621387a55ccecd4a5bcac318a1ae0a2fab58c6c7700f19137a6

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.