如何通过dotnetopenauth获取推特电子邮件?

时间:2012-03-08 23:52:45

标签: c# asp.net-mvc dotnetopenauth

  

可能重复:
  Is there a way to get an user's email ID after verifying her Twitter identity using OAuth?

我几乎让OpenID使用DotNetOpenAuth库。现在我想收到电子邮件。

 public ActionResult OAuth()
    {
 var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, TwitterTokenManager);
        AuthorizedTokenResponse accessTokenResponse = twitter.ProcessUserAuthorization();
        if (accessTokenResponse != null)
        {
            string accessToken = accessTokenResponse.AccessToken;
            string username = accessTokenResponse.ExtraData["screen_name"];
            // email goes here ??
            CreateAuthCookie(username, accessToken);
        }
        else
        {
            return RedirectToAction("LogOn");
        }

        return RedirectToAction("Index", "Home");

1 个答案:

答案 0 :(得分:1)

很抱歉,无法从Twitter获取用户的电子邮件地址。

看看以下

Is there a way to get an user's email ID after verifying his/her Twitter identity using OAuth?