[Solved] How to get the email address of twitter user with twitter api

I want to put a plug in on my website for “login with twitter”, and my website needs to get user’s twitterID and email after user allows my twitter application to access their data. I looked through the twitter dev documents, but it seems always all about OAuth with complicated examples. Is there an easy way to do this? I already put the same kind of plugin for facebook, and it is very simple. Thanks!

Solution #1:

If twitter doesn’t provide any API, then how does foursquare retrieve them?

  • Foursquare has provision to list out the user’s foursquare-friends who have registered with twitter.
  • It also provides API which shows friends of users who commonly appear in ‘foursquare friend’s list’ as well as ‘twitter followers list’ of the user.

In both the above cases comparison can be made only through email.

Respondent: Ambili Menon

Solution #2:

There is NO way you can get email address of a twitter user.
Twitter doesn’t provide it : https://dev.twitter.com/docs/faq#6718

Respondent: Ambili B Menon

Solution #3:

From the twitter api FAQ

How do I obtain a user’s email address?

If you’d like a user’s email address, you’ll need to ask a user for it
within the confines of your own application and service. The Twitter
API does not provide the user’s email address as part of the OAuth
token negotiation process nor does it offer other means to obtain it.

Respondent: Sindre

Solution #4:

Request a User’s Email Address

Requesting a user’s email address requires your application to be whitelisted by Twitter. To request access, please use this form.

Once whitelisted, the “Request email addresses from users” checkbox will be available under your app permissions on apps.twitter.com. Privacy Policy URL and Terms of Service URL fields will also be available under settings which are required for email access. If enabled, users will be informed via the oauth/authorize dialog that your app can access their email address.

Respondent: HenryP

Solution #5:

Go to https://support.twitter.com/forms/platform
Select “I need access to special permissions”
Enter Application Name and ID. These can be obtained via https://apps.twitter.com/ — the application ID is the numeric part in the browser’s address bar after you click your app.
Permissions Request: “Email address”
Submit & wait for response
After your request is granted, an addition permission setting is added in your twitter app’s “Permission” section. Go to “Additional Permissions” and just tick the checkbox for “Request email addresses from users”.

Respondent: Amritosh

Solution #6:

Twitter doesn’t provide the email address, this is why many websites using OAuth does not implement Twitter;because the user’s email address is part of the registration process.

Respondent: Irshu

Solution #7:

there is no way to get email by twitter, twitter does not provide email in api response.

see official twitter api link:

Respondent: adnan

Solution #8:

I’m working on C#.Net and I used the Tweetinvi API, its easy to use and has a good documentation.

Well to answer your question, it’s possible get the user’s email and all the data.

1st: You need to create your Twitter app on “apps.twitter.com” and register it. Then in the app management you’ll find a “Permission” tab and at the end of the page there is a checkbox that says if you need the email information. You’ll have to provide a link to your Privacy Terms so the user can read and agree to share the information with your app, you can use ‘https://google.com‘ but its recommended to provide a valid link.

And that’s all. In the code, you just need to authenticate the user and get the data you need.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tweetinvi;
using Tweetinvi.Models;

namespace APIS
    public class TwitterConfig
        IAuthenticationContext authenticationContext;

        /// <summary>
        /// Le indica a twitter que va a hacer una consulta de crendenciales. Esta consulta va a generar un PIN en caso de que sea correcto
        /// y el usuario tiene que digitar el pin.
        /// </summary>
        public void RequestForCredentials()

            authenticationContext = AuthFlow.InitAuthentication(appCredentials);

            //This opens a web-browser and asks to the twitter client 
            //to accept the terms, and twitter gives a code and the user
            // have to introduce it on the app (use the AuthByPin(String pin) method )
            //Thats the PIN for auth the user and then get the data

        /// <summary>
        /// Metodo que solicita un PIN que un usuario de Twitter al aceptar las condiciones se le brindó y este lo introdujo en la app
        /// para ser autenticado.
        /// </summary>
        /// <param name="pin">PIN del usuario</param>
        /// <returns>IAuthenticatedUser devuelve el usuario autenticado y con todos los datos.</returns>
        public IAuthenticatedUser AuthByPin(String pin) 
                // Con este código PIN ahora es posible recuperar las credenciales de Twitter 
                var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pin, authenticationContext);

                // Use las credenciales del usuario en su aplicación 

                var user = User.GetAuthenticatedUser();
                return user; 
            catch (Exception e)
                throw new ApplicationException("Problema al autenticar.", e);

If you have some question ask me

Respondent: Denner Portuguez

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.