Get user’s email address from twitter

May 19 at 2: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 =
                      await
                          (from acct in twitterCtx.Account
                           where (acct.Type == AccountType.VerifyCredentials) && (acct.IncludeEmail == true)
                           select acct)
                          .SingleOrDefaultAsync();

                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 http://www.bigbrainintelligence.com/Post/get-users-email-address-from-twitter-oauth-ap

it is an easy and clean solution