回答
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