How to use the @openid/appauth.BaseTokenRequestHandler function in @openid/appauth

To help you get started, we’ve selected a few @openid/appauth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pingidentity / angular-spa-sample / src / app / authorization.service.ts View on Github external
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()));
github imodeljs / imodeljs / core / clients-backend / src / oidc / OidcDeviceClient.ts View on Github external
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);
  }