Вот код, который использует аутентификацию oauth 1.0.
Войдите через твиттер, используя oauth-аутентификацию в asp.net, и получите токен доступа, отображаемое имя и идентификатор пользователя.
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 Классы и поймите, как это работает
Войдите в систему через Twitter, используя oauth-аутентификацию на asp.net, и получите токен доступа, отображаемое имя и идентификатор пользователя.