Pergunta

Is there any chance to retrive the email from a twitter user? I'm using the LinqToTwitter Nuget in C# Mvc4.

Please if you know anything :)!

Foi útil?

Solução 2

That data point isn't available in the Twitter API. You can see what is available here:

https://dev.twitter.com/docs/platform-objects/users

It follows that LINQ to Twitter can't provide an email either.

Outras dicas

this is how I have done it in c#

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)
{

}

http://www.bigbrainintelligence.com/Post/get-users-email-address-from-twitter-oauth-ap

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top