download
raw
1.27 kB
import { CodeChallengeMethod, OAuth2Client } from "../client.js";
export class Authentik {
authorizationEndpoint;
tokenEndpoint;
tokenRevocationEndpoint;
client;
constructor(domain, clientId, clientSecret, redirectURI) {
this.authorizationEndpoint = `https://${domain}/application/o/authorize/`;
this.tokenEndpoint = `https://${domain}/application/o/token/`;
this.tokenRevocationEndpoint = `https://${domain}/application/o/revoke`;
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;
}
async refreshAccessToken(refreshToken) {
const tokens = await this.client.refreshAccessToken(this.tokenEndpoint, refreshToken, []);
return tokens;
}
async revokeToken(token) {
await this.client.revokeToken(this.tokenRevocationEndpoint, token);
}
}

Xet Storage Details

Size:
1.27 kB
·
Xet hash:
29062765aeb07d05aced319c9308107ec667421dfab951d4e0dbc85c9d8449f5

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