TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Deepak Pandey
NA
75
0
Problem With Yahoo Login with open authentication
Oct 12 2011 7:28 AM
Hello,
I am using this code to for request token to use Sign in With yahoo using Oenid
this code is showing errorerror "oauth_problem=consumer_key_rejected"
what is wrong with code and what will be the correct code
Collapse | Copy Code
private void MakeRequestForToken()
{
string consumerKey =ConfigurationManager.AppSettings["YahooConsumerKey"];
string consumerSecret =ConfigurationManager.AppSettings["YahooConsumerSecret"];
string requestTokenEndpoint = "https://api.login.yahoo.com/oauth/v2/get_request_token";
string requestTokenCallback = GetRouteableUrlFromRelativeUrl("YahooValidation.aspx/authorizeToken/yahoo/");
string authorizeTokenUrl = "https://api.login.yahoo.com/oauth/v2/request_auth";
// Step 1: Make the call to request a token
var oAuthConsumer = new OAuthConsumerNew();
var requestToken = oAuthConsumer.GetOAuthRequestToken(requestTokenEndpoint, realm, consumerKey, consumerSecret, requestTokenCallback);
PersistRequestToken(requestToken);
// Step 2: Make a the call to authorize the request token
Response.Redirect(authorizeTokenUrl + "?oauth_token=" + requestToken.Token);
}
Collapse | Copy Code
private void HandleAuthorizeTokenResponse()
{
string consumerKey =ConfigurationManager.AppSettings["YahooConsumerKey"];
//string consumerSecret =ConfigurationManager.AppSettings["YahooConsumerSecret"];
string token = Request.QueryString["oauth_token"];
string verifier = Request.QueryString["oauth_verifier"];
string accessTokenEndpoint = "https://api.login.yahoo.com/oauth/v2/request_auth";
// Exchange the Request Token for an Access Token
var oAuthConsumer = new OAuthConsumerNew();
var accessToken = oAuthConsumer.GetOAuthAccessToken(accessTokenEndpoint, realm, consumerKey, consumerSecret, token, verifier, GetRequesttoken().TokenSecret);
var responseText = oAuthConsumer.GetUserInfo("https://www.yahoo.com/userinfo/email", realm, consumerKey, consumerSecret, accessToken.Token, accessToken.TokenSecret);
string queryString = responseText;
NameValueCollection nvc = StringToNameValueCollection(responseText);
if (nvc["email"] != "")
{
string userName = "";
//string password = "";
userName = nvc["email"].ToString();
}
}
and what will be the string accessTokenEndpoint = "https://api.login.yahoo.com/oauth/v2/request_auth";
Is this accessTokenEndpoint retrive user information like userid,firstname and lastname
or if this will not return this value then what should use to get resired result form yahoo login
Thanks,
Deepak
Reply
Answers (
2
)
Uploading a video file to streaming server
Solve NullValueException handled by user code