This project has moved and is read-only. For the latest updates, please go here.

Get user’s email address from twitter

May 19, 2016 at 3:30 PM
this is how I fixed common problem with this library
it was very useful and I want to share the solution in case someone need it

v try
                // we need to call the user authentication credetials verification api )(using linqtotwitter library) to get the user email
                var authTwitter = new SingleUserAuthorizer
                    CredentialStore = new SingleUserInMemoryCredentialStore
                        ConsumerKey = TwConsumerKey,
                        ConsumerSecret = TwConsumerSecret,
                        OAuthToken = accessTokenClaim.Value,
                        OAuthTokenSecret = accessTokenSecretClaim.Value,
                        UserID = ulong.Parse(loginInfo.Login.ProviderKey),
                        ScreenName = loginInfo.DefaultUserName

                await authTwitter.AuthorizeAsync();
// call verify credentials api
                var twitterCtx = new TwitterContext(authTwitter);
                var verifyResponse =
                          (from acct in twitterCtx.Account
                           where (acct.Type == AccountType.VerifyCredentials) && (acct.IncludeEmail == true)
                           select acct)

                if (verifyResponse != null && verifyResponse.User != null)
                    User twitterUser = verifyResponse.User;
//assign email to existing authentication object
                    loginInfo.Email = twitterUser.Email;

            catch (TwitterQueryException tqe)


see how I have done this here

it is an easy and clean solution