How to use the @openid/appauth/built/authorization_request.AuthorizationRequest 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 FlashAirDevelopers / FlashAirFileManager / src / main / auth.js View on Github external
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(
        this.authConfiguration, request);
  }
  _performWithInitTokenRequest(code) {
github googlesamples / appauth-js-electron-sample / flow.ts View on Github external
makeAuthorizationRequest(username?: string) {
    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
    );
  }