Get user email with oauth 2


#1

How do I retrieve the email address of a signed-in user? I’ve been whitelisted for email, and updated my app settings, but my user object still comes back without an email entry. Is there a separate call for emails?

I’m running a node.js server, with the node-twitter-api module, and have successfully completed the oauth login flow.


#2

Yes there is a separate call for email information - check the verify_credentials documentation on dev.twitter.com for the syntax.


#3

FOUND IT. I’m currently making dinner, and may not get to this tomorrow, so I will assume that this is the piece I was missing, and say THANKS!, now. :slightly_smiling:


#4

And it indeed works!

In case you encounter somebody else who is using the node twitter module, the proper use, once your app has been set up, looks like:

            var params = {
                'include_email' : true
            };

           twitter.verifyCredentials(accessToken, accessSecret, params, function(err, user)....

The module takes the dict passed in the third parameter and adds it appropriately, or ignores it if there are only 3 params.

Thanks again!


#5