src/index.js
/**
   * Authenticate request by delegating to a service provider using OAuth 2.0.
   * @param {Object} req
   * @param {Object} options
   */
Authenticate request by delegating to a service provider using OAuth 2.0.
@param {Object} req
@param {Object} options
Authenticate request by delegating to a service provider using OAuth 2 . 0 . @param { Object } req @param { Object } options
authenticate(req, options) {
    const accessToken = this.lookup(req, this._accessTokenField);
    const refreshToken = this.lookup(req, this._refreshTokenField);
    const idToken = this.lookup(req, this._idToeknField);
    if (!accessToken) return this.fail({ message: `You should provide ${this._accessTokenField}` });
    this._loadUserProfile(accessToken, (error, profile) => {
      if (error) return this.error(error);
      const verified = (error, user, info) => {
        if (error) return this.error(error);
        if (!user) return this.fail(info);
        return this.success(user, info);
      };
      if (this._passReqToCallback) {
        this._verify(req, accessToken, refreshToken, profile, verified);
      } else {
        this._verify(accessToken, refreshToken, profile, verified);
      }
    });
  }
authenticate ( req , options ) { const accessToken = this . lookup ( req , this . _accessTokenField ) ; const refreshToken = this . lookup ( req , this . _refreshTokenField ) ; const idToken = this . lookup ( req , this . _idToeknField ) ; if ( ! accessToken ) return this . fail ( { message : ` ${ this . _accessTokenField } ` } ) ; this . _loadUserProfile ( accessToken , ( error , profile ) => { if ( error ) return this . error ( error ) ; const verified = ( error , user , info ) => { if ( error ) return this . error ( error ) ; if ( ! user ) return this . fail ( info ) ; return this . success ( user , info ) ; } ; if ( this . _passReqToCallback ) { this . _verify ( req , accessToken , refreshToken , profile , verified ) ; } else { this . _verify ( accessToken , refreshToken , profile , verified ) ; } } ) ; }
Authenticate request by delegating to a service provider using OAuth 2.0.
Authenticate request by delegating to a service provider using OAuth 2 . 0 .