Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.notifier.setAuthorizationListener((request, response, error) => {
console.log('Authorization request complete ', request, response, error);
if (response && response.code) {
const tokenHandler = new BaseTokenRequestHandler(this.requestor);
// use the code to make the token request.
const extras: StringMap = {};
if (this.environment.client_secret) {
extras['client_secret'] = this.environment.client_secret;
}
extras['code_verifier'] = request.internal['code_verifier'];
const tokenRequest = new TokenRequest({
client_id: this.environment.client_id,
redirect_uri: this.environment.redirect_uri,
grant_type: GRANT_TYPE_AUTHORIZATION_CODE,
code: response.code,
extras: extras
});
console.log('making token request:' + JSON.stringify(tokenRequest.toStringMap()));
public constructor(clientConfiguration: OidcFrontendClientConfiguration) {
super();
this._clientConfiguration = clientConfiguration;
this._notifier = new AuthorizationNotifier();
this._authorizationHandler = new NodeBasedHandler();
this._tokenHandler = new BaseTokenRequestHandler(this._nodeRequestor);
// set notifier to deliver responses
this._authorizationHandler.setAuthorizationNotifier(this._notifier);
const redirectUrl = new URL(this._clientConfiguration.redirectUri);
this._authorizationHandler.httpServerPort = +redirectUrl.port;
// set a listener to listen for authorization responses
this._notifier.setAuthorizationListener(this.authorizationListener);
}