Twitter OAuth Strategy Access Level & Email Problem

171 views Asked by At

I have a Twitter OAuth strategy like this:

consumerKey: process.env.CONSUMER_KEY,
consumerSecret: process.env.CONSUMER_SECRET,
userProfileURL: "https://api.twitter.com/1.1/account/verify_credentials.json?include_email=true",
requestTokenURL: 'https://api.twitter.com/oauth/request_token?x_auth_access_type=read',
callbackURL: '/dashboard/auth/callback',
proxy: true

Now, here whenever I include requestTokenURL: 'https://api.twitter.com/oauth/request_token?x_auth_access_type=read', I am not able to access the user's email. If I remove it, I am able to access the email via userProfileURL: "https://api.twitter.com/1.1/account/verify_credentials.json?include_email=true".

I have enabled the request email permission in the developer dashboard. What am I missing? I am using the passport-twitter library for this.

1

There are 1 answers

1
Marc On

Unfortunately this does not seem possible.

Unfortunately the initial x_auth_access_type setting was created at a point long before the email permission was added, and has only ever allowed one or other of the read or write values to be specified. I think what you’re seeing here is that using that parameter does perform an absolute override on what you have configured on the app settings. I’ll note this as something we should improve in the future, but at the moment I can’t say when or if we’re likely to change that behaviour.

Source: https://twittercommunity.com/t/email-is-not-requested-when-x-auth-access-type-parameter-added/72396/5