Skip to content

Commit

Permalink
Allow users to specify both x_auth_access_type and the stragety name …
Browse files Browse the repository at this point in the history
…in case they need a different set of options for difference use cases. Say normal users vs enterprise users.
  • Loading branch information
bobber205 committed Oct 14, 2020
1 parent cfe7807 commit 8f7d905
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/strategy.js
Expand Up @@ -46,12 +46,16 @@ var OAuthStrategy = require('passport-oauth1')
function Strategy(options, verify) {
options = options || {};
options.requestTokenURL = options.requestTokenURL || 'https://api.twitter.com/oauth/request_token';
if (options.x_auth_access_type !== undefined) {
options.requestTokenURL = `${options.requestTokenURL}?x_auth_access_type=${options.x_auth_access_type}`
}
options.accessTokenURL = options.accessTokenURL || 'https://api.twitter.com/oauth/access_token';
options.userAuthorizationURL = options.userAuthorizationURL || 'https://api.twitter.com/oauth/authenticate';
options.sessionKey = options.sessionKey || 'oauth:twitter';

OAuthStrategy.call(this, options, verify);
this.name = 'twitter';

this.name = options.strategy_name || 'twitter';
this._userProfileURL = options.userProfileURL || 'https://api.twitter.com/1.1/account/verify_credentials.json';
this._skipExtendedUserProfile = (options.skipExtendedUserProfile !== undefined) ? options.skipExtendedUserProfile : false;
this._includeEmail = (options.includeEmail !== undefined) ? options.includeEmail : false;
Expand Down

0 comments on commit 8f7d905

Please sign in to comment.