How to use the @openid/appauth/built/crypto_utils.cryptoGenerateRandom 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
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(
github FlashAirDevelopers / FlashAirFileManager / src / main / auth.js View on Github external
_makeCodeVerifier() {
    // minimum raw length 32
    // see: https://tools.ietf.org/html/rfc7636#section-4.1
    return Base64.encodeURI(cryptoGenerateRandom(32));
  }
  // Base64url Encoding without Padding