我对使用Twitterizer有疑问 我想获取TwitterUser模型,以便从Twitter上的响应请求中获取用户的信息,但我不知道如何。
这是我的代码:
public ActionResult Logon(string oauth_token, string oauth_verifier, string ReturnUrl)
{
if (string.IsNullOrEmpty(oauth_token) || string.IsNullOrEmpty(oauth_verifier))
{
UriBuilder builder = new UriBuilder(this.Request.Url);
builder.Query = string.Concat(
builder.Query,
string.IsNullOrEmpty(builder.Query) ? string.Empty : "&",
"ReturnUrl=",
ReturnUrl);
string token = OAuthUtility.GetRequestToken(
ConfigurationManager.AppSettings["TwitterConsumerKey"],
ConfigurationManager.AppSettings["TwitterConsumerSecret"],
builder.ToString()).Token;
//return Redirect(OAuthUtility.BuildAuthorizationUri(token, true).ToString());
Response.Redirect(string.Format("http://twitter.com/oauth/authenticate?oauth_token={0}&force_login=true", token), true);
}
var tokens = OAuthUtility.GetAccessToken(
ConfigurationManager.AppSettings["TwitterConsumerKey"],
ConfigurationManager.AppSettings["TwitterConsumerSecret"],
oauth_token,
oauth_verifier);
OAuthTokens accessToken = new OAuthTokens();
accessToken.AccessToken = tokens.Token;
accessToken.AccessTokenSecret = tokens.TokenSecret;
accessToken.ConsumerKey = ConfigurationManager.AppSettings["TwitterConsumerKey"];
accessToken.ConsumerSecret = ConfigurationManager.AppSettings["TwitterConsumerSecret"];
//TwitterUser u =
TwitterUser myTwitterUser = ..............
..............
}
我已经获得了OAuthTokens。在“.........”之后,我不知道接下来要做什么来为用户获取信息。
任何人都可以帮助我.Thansk很多
答案 0 :(得分:0)
您是否尝试过查看documentation
:
TwitterResponse<TwitterUser> myTwitterUser = TwitterUser.Show(accessToken, "twit_er_izer");