[英]Retrieve Email from Twitter?? Mvc4 C#
Is there any chance to retrive the email from a twitter user? 有机会从Twitter用户那里检索电子邮件吗? I'm using the LinqToTwitter Nuget in C# Mvc4. 我在C#Mvc4中使用LinqToTwitter Nuget。
Please if you know anything :)! 请如果您知道什么:)!
this is how I have done it in c# 这就是我在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 http://www.bigbrainintelligence.com/Post/get-users-email-address-from-twitter-oauth-ap
That data point isn't available in the Twitter API. 该数据点在Twitter API中不可用。 You can see what is available here: 您可以在此处查看可用内容:
https://dev.twitter.com/docs/platform-objects/users https://dev.twitter.com/docs/platform-objects/users
It follows that LINQ to Twitter can't provide an email either. 因此,LINQ to Twitter也无法提供电子邮件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.