How to use passport-strategy
Comprehensive passport-strategy code examples:
How to use passport-strategy.use:
48 49 50 51 52 53 54 55 56 57
* - `callbackURL` URL to which the service provider will redirect the user after obtaining authorization * - `passReqToCallback` when `true`, `req` is the first argument to the verify callback (default: `false`) * * Examples: * * passport.use(new OAuth2Strategy({ * authorizationURL: 'https://www.example.com/oauth2/authorize', * tokenURL: 'https://www.example.com/oauth2/token', * clientID: '123-456-789', * clientSecret: 'shhh-its-a-secret'
How to use passport-strategy.Strategy:
82 83 84 85 86 87 88 89 90 91
if (!options.authorizationURL) { throw new TypeError('OAuth2Strategy requires a authorizationURL option'); } if (!options.tokenURL) { throw new TypeError('OAuth2Strategy requires a tokenURL option'); } if (!options.clientID) { throw new TypeError('OAuth2Strategy requires a clientID option'); } if (!options.clientSecret) { throw new TypeError('OAuth2Strategy requires a clientSecret option'); } passport.Strategy.call(this); this.name = 'oauth2'; this._verify = verify; // NOTE: The _oauth2 property is considered "protected". Subclasses are