Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
performAuthorizationRequest() {
if (!this.config || !this.authConfiguration) {
log.error('Unknown service configuration');
return;
}
this.authState = cryptoGenerateRandom(10);
// extra prameter for OAuth PKCE code_challenge
const extra = [];
if (this.codePair) {
this.codePair.generate();
log.debug('generate code pair');
extra['code_challenge_method'] = this.codePair.codeChallengeMethod;
extra['code_challenge'] = this.codePair.codeChallenge;
log.debug(extra);
}
// create a request
const request = new AuthorizationRequest(
this.config.clientId, this.config.redirectUri, this.config.scope,
AuthorizationRequest.RESPONSE_TYPE_CODE,
this.authState, extra);
this.authorizationHandler.performAuthorizationRequest(
_makeCodeVerifier() {
// minimum raw length 32
// see: https://tools.ietf.org/html/rfc7636#section-4.1
return Base64.encodeURI(cryptoGenerateRandom(32));
}
// Base64url Encoding without Padding