Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!this.configuration) {
log("Unknown service configuration");
return;
}
const extras: StringMap = { prompt: "consent", access_type: "offline" };
if (username) {
extras["login_hint"] = username;
}
// create a request
const request = new AuthorizationRequest(
clientId,
redirectUri,
scope,
AuthorizationRequest.RESPONSE_TYPE_CODE,
undefined /* state */,
extras
);
log("Making authorization request ", this.configuration, request);
this.authorizationHandler.performAuthorizationRequest(
this.configuration,
request
);
}
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(
this.authConfiguration, request);
}
_performWithInitTokenRequest(code) {