回答
verify_credentials API request将返回有关当前登录用户的信息。
另外,Twitter对OAuth访问令牌请求(即OAuth登录过程的最后部分)的响应与用户的屏幕名称和Twitter用户ID一起回应通常的oauth令牌和秘密。
使用Twitterizer库,这里是一个代码片段。
OAuthTokenResponse reqToken = OAuthUtility.GetAccessToken(ConsumerKey, ConsumerSecret, requestToken);
long UserID = reqToken.UserId;
string ScreenName = reqToken.ScreenName;
我已经在我的博客上发布了示例代码。 http://www.fairnet.com/post/2010/09/05/Twitter-authentication-using-OAuth.aspx
我们是否只从twitter获取这些详细信息UserID和ScreenName? 另外你的博客没有得到。获取找不到资源的错误。 – NCA
这里是使用oauth认证1.0的代码。
OAuthHelper oauthhelper = new OAuthHelper();
string requestToken = oauthhelper.GetRequestToken();
if (string.IsNullOrEmpty(oauthhelper.oauth_error))
Response.Redirect(oauthhelper.GetAuthorizeUrl(requestToken));
else
Response.Write(oauthhelper.oauth_error);
返回URL。
if (Request.QueryString["oauth_token"] != null && Request.QueryString["oauth_verifier"]!=null)
{
string oauth_token = Request.QueryString["oauth_token"];
string oauth_verifier = Request.QueryString["oauth_verifier"];
OAuthHelper oauthhelper = new OAuthHelper();
oauthhelper.GetUserTwAccessToken(oauth_token, oauth_verifier);
if (string.IsNullOrEmpty(oauthhelper.oauth_error))
{
Session["twtoken"] = oauthhelper.oauth_access_token;
Session["twsecret"] = oauthhelper.oauth_access_token_secret;
Session["twuserid"] = oauthhelper.user_id;
Session["twname"] = oauthhelper.screen_name;
Response.Write("<b>AccessToken=</b>" + oauthhelper.oauth_access_token);
Response.Write("<br /><b>Access Secret=</b>" + oauthhelper.oauth_access_token_secret);
Response.Write("<br /><b>Screen Name=</b>" + oauthhelper.screen_name);
Response.Write("<br /><b>Twitter User ID=</b>" + oauthhelper.user_id);
}
else
Response.Write(oauthhelper.oauth_error);
}
获取oAuthHelper和oAuthUttility类并了解它是如何工作 Login with twitter using oauth authentication in asp.net and get access token, screen name and userid.
好。 o我们仅从twitter获取这些详细信息UserID和ScreenName。我们怎样才能获得其他detials作为电话号码,图像等。 – NCA
- 1. Twitter oAuth:更新经过身份验证的用户身份
- 2. 使用Windows身份验证和匿名身份验证获取用户名
- 3. Android如何在通过Twitter身份验证后获取用户的全名
- 4. iOS中的Twitter oAuth身份验证
- 5. Twitter身份验证OAuth或XAuth
- 6. Twitter中的OAuth身份验证
- 7. 获取OAuth身份验证错误
- 8. 用户身份验证使用OAuth
- 9. 获取用户的Twitter主页没有身份验证
- 10. OAuth身份验证,无效签名
- 11. WCF - 传输身份验证 - 获取身份验证用户的凭证
- 12. 获取“无法使用OAuth进行身份验证”。从Twitter尝试POST时
- 13. OAuth身份验证失败
- 14. OAuth身份验证到EWS
- 15. Delphi OAuth身份验证
- 16. Vimeo OAuth 2身份验证
- 17. OAuth身份验证Iphone
- 18. OAuth身份验证,如Facebook
- 19. OAuth 2.0身份验证SSL
- 20. OAuth身份验证错误
- 21. Spring身份验证 - 获取登录名
- 22. 获取用户的身份而不进行身份验证
- 23. 如何使用CherryPy摘要身份验证获取用户名
- 24. 验证用户的Web Api OAuth身份验证
- 25. 使用Windows身份验证和匿名身份验证获取UserPrincipal
- 26. 使用Twitter身份验证验证用户
- 27. 如何使用普通HTTP身份验证和PHP在Apache下获取经过身份验证的用户名?
- 28. 无论身份验证领域如何获取用户名
- 29. Windows身份验证 - 获取当前用户名
- 30. 获取表单身份验证中的用户名
如何捕捉到这些的呢? – fixmycode