使用声明oauth 2获取推特个人资料图片

时间:2014-06-09 13:32:42

标签: .net asp.net-mvc oauth-2.0 twitter-oauth

我有一个网站设置接受Twitter和Facebook外部登录。

有没有办法使用声明获取推特个人资料图片?

var twitter = new TwitterAuthenticationOptions
            {
                ConsumerKey = AuthenticationSettings.Twitter.ConsumerKey,
                ConsumerSecret = AuthenticationSettings.Twitter.ConsumerSecret,
                AuthenticationType = Constants.ExternalProviders.Twitter,
                SignInAsAuthenticationType = DefaultAuthenticationTypes.ExternalCookie,
                Provider = new TwitterAuthenticationProvider()
                {
                    OnAuthenticated = async ctx =>
                    {
                        //SOME CODE HERE TO GET PROFILE PHOTO
                    }
                }
            };

否则,获取个人资料照片的最佳方式是什么?

1 个答案:

答案 0 :(得分:0)

显然没有一种简单的方法可以做到这一点,你需要使用Twitter Api。

Look here, get-the-twitter-profile-image-using-the-asp-net-identity