How to use the @openid/appauth/built/authorization_request_handler.AuthorizationNotifier 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 googlesamples / appauth-js-electron-sample / flow.ts View on Github external
constructor() {
    this.notifier = new AuthorizationNotifier();
    this.authStateEmitter = new AuthStateEmitter();
    this.authorizationHandler = new NodeBasedHandler();
    this.tokenHandler = new BaseTokenRequestHandler(requestor);
    // set notifier to deliver responses
    this.authorizationHandler.setAuthorizationNotifier(this.notifier);
    // set a listener to listen for authorization responses
    // make refresh and access token requests.
    this.notifier.setAuthorizationListener((request, response, error) => {
      log("Authorization request complete ", request, response, error);
      if (response) {
        this.makeRefreshTokenRequest(response.code)
          .then(result => this.performWithFreshTokens())
          .then(() => {
            this.authStateEmitter.emit(AuthStateEmitter.ON_TOKEN_RESPONSE);
            log("All Done.");
          });
github FlashAirDevelopers / FlashAirFileManager / src / main / auth.js View on Github external
usePCKE
  }, action, tokenStoreHander) {
    if (!config) {
      throw new Error('Configuration is not specified.');
    }
    log.debug(config);
    log.debug(action);
    log.debug(tokenStoreHander);
    this.config = config;
    this.action = action;
    this.tokenStoreHander = tokenStoreHander || function(token) {log.debug(token);};
    this.authConfiguration = new AuthorizationServiceConfiguration(
      config.authorizationEndPoint,
      config.tokenEndPoint
    );
    this.notifier = new AuthorizationNotifier();
    this.authorizationHandler = new NodeBasedHandler(
      config.redirectPort, new IoTHubQueryStringUtils());
    this.requestor = new NodeRequestor();
    this.tokenHandler = new IoTHubTokenRequestHandler(this.requestor);
    this.authorizationHandler.setAuthorizationNotifier(this.notifier);
    this.notifier.setAuthorizationListener((request, response, error) => {
      if (error) {
        log.error(error);
        return this.action.invalidAccessToken(error);
      }
      if (response) {
        if (this.authState !== response.state) {
          return this.action.invalidAccessToken(resources.auth_msg_invalid_access_token);
        }
        this._performWithInitTokenRequest(response.code)
        // .then(accessToken => this._performWithFreshTokens(accessToken))