0

Continue getting 401 error while trying to get_request_token

Hi, i followed the instruction at
http://developer.yahoo.com/oauth/guide/oau...th-requesttoken (STEP 2)
but always get the 401 error.

I am using C# and i also try to put the oauth params to the request header but it does not help.
I saw that many people here keep getting this problem. Is there any final answer?

Thanks

9 Replies
  • QUOTE (Nguyễn Văn Thoại @ Nov 5 2009, 11:06 PM) <{POST_SNAPBACK}>
    Hi, i followed the instruction at
    http://developer.yahoo.com/oauth/guide/oau...th-requesttoken (STEP 2)
    but always get the 401 error.

    I am using C# and i also try to put the oauth params to the request header but it does not help.
    I saw that many people here keep getting this problem. Is there any final answer?

    Thanks


    Nguyen,

    It is working for me, can your provide the request/response including headers? Also, you can use the C# open social sdk to make this a bit easier: http://developer.yahoo.com/social/sdk/#opensocial
    0
  • QUOTE (Dustin Whittle @ Nov 6 2009, 12:21 PM) <{POST_SNAPBACK}>
    Nguyen,

    It is working for me, can your provide the request/response including headers? Also, you can use the C# open social sdk to make this a bit easier: http://developer.yahoo.com/social/sdk/#opensocial

    i'm using C# . for twitter api using oauth no problem but yahoo api i have 401 error when i send request get_request_token
    0
  • QUOTE (AGHILAS @ Feb 25 2010, 04:33 AM) <{POST_SNAPBACK}>
    i'm using C# . for twitter api using oauth no problem but yahoo api i have 401 error when i send request get_request_token

    Can you show me an example in c# please.
    thanks
    0
  • Hi Dustin,


    Sorry for the late response.
    I am currently get an other issue which i mentioned here: http://developer.yahoo.net/forum/index.php...&#entry9916


    If you have any suggestion, please let me know. Thank you very much.
    0
  • I am also having a problem with 401 error when trying to get a request token from yahoo contact api. I am using the latest OAuthBase.cs
    This is very frustrating I don't know why it has to be so complicated to get this working. PLEASE HELP!!!!

    Here is the code being used:

    Uri YahooAuthRequestToken = new Uri("https://api.login.yahoo.com/oauth/v2/get_request_token");

    OAuth.OAuthBase oAuth = new OAuth.OAuthBase();
    string nonce = oAuth.GenerateNonce();
    string timeStamp = oAuth.GenerateTimeStamp();
    string sig = oAuth.GenerateSignature(YahooAuthRequestToken,
    consumerKey, consumerSecret,
    string.Empty, string.Empty,
    "GET", timeStamp, nonce,
    OAuth.OAuthBase.SignatureTypes.HMACSHA1,out normaluri , out normaluriparam);

    sig = HttpUtility.UrlEncode(sig);

    StringBuilder sb = new StringBuilder(YahooAuthRequestToken.ToString());
    sb.AppendFormat("?oauth_callback={0}&", "oob");
    sb.AppendFormat("oauth_consumer_key={0}&", consumerKey);
    sb.AppendFormat("oauth_nonce={0}&", nonce);
    sb.AppendFormat("oauth_timestamp={0}&", timeStamp);
    sb.AppendFormat("oauth_signature_method={0}&", "HMAC-SHA1");
    sb.AppendFormat("oauth_version={0}&", "1.0");
    sb.AppendFormat("oauth_signature={0}", sig.ToString());

    try
    {

    request = WebRequest.Create(sb.ToString()) as HttpWebRequest;


    using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
    {
    StreamReader GetAuthToken = new StreamReader(response.GetResponseStream());
    YahooAuthToken = GetAuthToken.ReadToEnd();
    MessageBox.Show(YahooAuthToken);
    }
    }
    catch (Exception ex)
    {
    MessageBox.Show( "ERROR: " + ex.Message);
    }


    HERE IS THE VALUE OF sb.ToString() in the WebRequest.Create(sb.ToString()

    https://api.login.yahoo.com/oauth/v2/get_re...llback=oob&
    oauth_consumer_key=dj0yJmk0bd...(REMOVED FOR MY APP SECURTIY)...meD1kMw--
    &oauth_nonce=4228703&oauth_timestamp=126890185&oauth_signature
    _method=HMAC-SHA1&oauth_version=1.0&oauth_signature=kSUT6rXzpTgnDwdmbHMAjNQjOZU%3d
    0
  • Hi All,

    I'm having the same problem. The same code that I use to connect using oAuth is working for LinkedIn, Twitter, PhotoBucket and Smugmug...

    I need to make it work for Yahoo asap.

    I don't know what is happening because I'm generating the query string as in the Yahoo API documentation.

    It throws me an exception when get_request_token (a 401 one) and when looking at the details it says OAuth oauth_problem=signature_invalid

    The strange thing is that I'm using oAuthBase that is a C# class that is a generic one. In the other Social Networks is working but not in Yahoo.

    I added the parameter oauth_callback because perhaps it was the reason of the error because it was missing but it wasn't.

    Any ideas of whas is happening?

    Thanks!
    0
  •  I catched the same thing
    0
  • Same problem for me. :(

    0
  • I found a much simpler solution. :) See it posted at: http://developer.yahoo.com/forum/OAuth-General-Discussion-YDN-SDKs/401-Unauthorized-access-with-get-request-token/1365023216190-47426b75-954d-43da-9213-a5a10d31b1f3

    0

Recent Posts

in Contacts