Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function Strategy(options, verify) {
options = options || {};
options.authorizationURL = options.authorizationURL || 'https://accounts.google.com/o/oauth2/v2/auth';
options.tokenURL = options.tokenURL || 'https://www.googleapis.com/oauth2/v4/token';
OAuth2Strategy.call(this, options, verify);
this.name = 'google';
this._userProfileURL = options.userProfileURL || 'https://www.googleapis.com/oauth2/v3/userinfo';
var url = uri.parse(this._userProfileURL);
if (url.pathname.indexOf('/userinfo') == (url.pathname.length - '/userinfo'.length)) {
this._userProfileFormat = 'openid';
} else {
this._userProfileFormat = 'google+'; // Google Sign-In
}
}
options.state = true;
options.botPrompt = _options.botPrompt || defaultOptions.botPrompt;
options.scope = _options.scope || defaultOptions.scope;
options.uiLocales = _options.uiLocales || defaultOptions.uiLocales;
options.authorizationURL = options.authorizationURL || defaultOptions.authorizationURL;
options.tokenURL = options.tokenURL || defaultOptions.tokenURL;
if (!options.botPrompt) {
delete options.botPrompt;
}
if (!options.uiLocales) {
delete options.uiLocales;
}
OAuth2Strategy.call(this, options, verify);
this.name = 'line';
this._profileURL = options.profileURL || defaultOptions.profileURL;
this._clientId = options.clientID;
this._clientSecret = options.clientSecret;
this._botPrompt = options.botPrompt;
if (options.uiLocales) {
this._uiLocales = options.uiLocales;
}
// this will specify whether to use an 'Authorize' header instead of passing the access_token as a query parameter (By node-oauth)
// Use Authorization Header (Bearer with Access Token) for GET requests. Used to get User's profile.
this._oauth2.useAuthorizationHeaderforGET(defaultOptions.useAuthorizationHeaderforGET);
}
function Strategy(options, verify) {
options = options || {};
options.authorizationURL = options.authorizationURL || 'https://github.com/login/oauth/authorize';
options.tokenURL = options.tokenURL || 'https://github.com/login/oauth/access_token';
options.scopeSeparator = options.scopeSeparator || ',';
options.customHeaders = options.customHeaders || {};
if (!options.customHeaders['User-Agent']) {
options.customHeaders['User-Agent'] = options.userAgent || 'passport-github';
}
OAuth2Strategy.call(this, options, verify);
this.name = 'github';
this._userProfileURL = options.userProfileURL || 'https://api.github.com/user';
this._oauth2.useAuthorizationHeaderforGET(true);
// NOTE: GitHub returns an HTTP 200 OK on error responses. As a result, the
// underlying `oauth` implementation understandably does not parse the
// response as an error. This code swizzles the implementation to
// handle this condition.
var self = this;
var _oauth2_getOAuthAccessToken = this._oauth2.getOAuthAccessToken;
this._oauth2.getOAuthAccessToken = function(code, params, callback) {
_oauth2_getOAuthAccessToken.call(self._oauth2, code, params, function(err, accessToken, refreshToken, params) {
if (err) { return callback(err); }
if (!accessToken) {
return callback({
statusCode: 400,
function Strategy(options, verify) {
options = options || {};
this._baseURL = options.baseURL || 'https://gitlab.com';
options.authorizationURL = options.authorizationURL || url.resolve(this._baseURL, 'oauth/authorize');
options.tokenURL = options.tokenURL || url.resolve(this._baseURL, 'oauth/token');
options.scope = options.scope || 'read_user';
options.scopeSeparator = options.scopeSeparator || ',';
OAuth2Strategy.call(this, options, verify);
this.name = 'gitlab';
this._profileURL = options.profileURL || url.resolve(this._baseURL, 'api/v4/user');
this._oauth2.useAuthorizationHeaderforGET(true);
}
function MovesStrategy(options, verify) {
options = options || {};
options.authorizationURL = config.moves.authorization_url;
options.tokenURL = config.moves.token_url;
OAuth2Strategy.call(this, options, verify);
this.name = 'moves';
this._limiter = new MovesLimiter();
}
function MicrosoftStrategy(options, verify) {
options = options || {}
options.authorizationURL = options.authorizationURL || 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize';
options.tokenURL = options.tokenURL || 'https://login.microsoftonline.com/common/oauth2/v2.0/token';
options.scopeSeparator = options.scopeSeparator || ' ';
options.customHeaders = options.customHeaders || {};
OAuth2Strategy.call(this, options, verify)
this.name = 'microsoft'
}
function Strategy(options, verify) {
options = options || {};
options.authorizationURL = options.authorizationURL || 'https://login.live.com/oauth20_authorize.srf';
options.tokenURL = options.tokenURL || 'https://login.live.com/oauth20_token.srf';
OAuth2Strategy.call(this, options, verify);
this.name = 'windowslive';
this._userProfileURL = options.userProfileURL || 'https://apis.live.net/v5.0/me';
}
function Strategy(options, verify) {
options = options || {}
options.authorizationURL = options.authorizationURL || 'https://api.veritone.com/v1/admin/oauth/authorize';
options.tokenURL = options.tokenURL || 'https://api.veritone.com/v1/admin/oauth/token';
options.scopeSeparator = options.scopeSeparator || ' ';
OAuth2Strategy.call(this, options, verify);
this.name = 'veritone';
this._profileUrl = options.profileUrl || 'https://api.veritone.com/v1/admin/current-user';
this._oauth2.useAuthorizationHeaderforGET(true)
}
function FacebookTokenStrategy(options, verify) {
options = options || {};
options.authorizationURL = options.authorizationURL || 'https://www.facebook.com/v2.2/dialog/oauth';
options.tokenURL = options.tokenURL || 'https://graph.facebook.com/oauth/access_token';
options.scopeSeparator = options.scopeSeparator || ',';
OAuth2Strategy.call(this, options, verify);
this.name = 'facebook-token';
this._accessTokenField = options.accessTokenField || 'access_token';
this._refreshTokenField = options.refreshTokenField || 'refresh_token';
this._passReqToCallback = options.passReqToCallback;
this._profileURL = options.profileURL || 'https://graph.facebook.com/v2.2/me';
this._clientSecret = options.clientSecret;
this._enableProof = options.enableProof;
this._profileFields = options.profileFields || null;
this._oauth2._useAuthorizationHeaderForGET = false;
}