download
raw
1.14 kB
import { CodeChallengeMethod, OAuth2Client } from "../client.js";
export class MicrosoftEntraId {
authorizationEndpoint;
tokenEndpoint;
client;
constructor(tenant, clientId, clientSecret, redirectURI) {
this.authorizationEndpoint = `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/authorize`;
this.tokenEndpoint = `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/token`;
this.client = new OAuth2Client(clientId, clientSecret, redirectURI);
}
createAuthorizationURL(state, codeVerifier, scopes) {
const url = this.client.createAuthorizationURLWithPKCE(this.authorizationEndpoint, state, CodeChallengeMethod.S256, codeVerifier, scopes);
return url;
}
async validateAuthorizationCode(code, codeVerifier) {
const tokens = await this.client.validateAuthorizationCode(this.tokenEndpoint, code, codeVerifier);
return tokens;
}
// v3 TODO: Add `scopes` parameter
async refreshAccessToken(refreshToken) {
const tokens = await this.client.refreshAccessToken(this.tokenEndpoint, refreshToken, []);
return tokens;
}
}

Xet Storage Details

Size:
1.14 kB
·
Xet hash:
9e46778c54f899e3a1a953340920c4205f1020a9fbaa42033b3a72cec98312f9

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