0

Unable to obtain token

Hello, I am getting the following output when I try to obtain a request token and would appreciate any assistance in resolving the issue. Note that I have registered my key as Client/Desktop app.

Here is my bash script for testing:

timestamp="$(date %s)"

nonce=

key="dj0yJmk9bkZWbFVOeklYYjZHJmQ9WVdrOVRIaGtaRkpNTTJNbWNHbzlNVE0wTXpjMU9EVTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD1lNQ--" method=PLAINTEXT sig="f1fd94c079d55a6cda5f2ad18bc0ac4cdcd8f2b8" callback=oob wget -S -d https://api.login.yahoo.com/oauth/v2/get_request_token --post-data="oauth_version=1.0&oauth_nonce=8c76a87ffd3e4f48b53ed4b669b0b35f&oauth_timestamp=$timestamp&oauth_consumer_key=$key&oauth_signature_method=$method&oauth_signature=$sig&oauth_callback=$callback" -v

Below is the output of the program:

Setting --post-data (postdata) to oauth_version=1.0&oauth_nonce=8c76a87ffd3e4f48b53ed4b669b0b35f&oauth_timestamp=1359222974&oauth_consumer_key=dj0yJmk9bkZWbFVOeklYYjZHJmQ9WVdrOVRIaGtaRkpNTTJNbWNHbzlNVE0wTXpjMU9EVTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD1lNQ--&oauth_signature_method=PLAINTEXT&oauth_signature=f1fd94c079d55a6cda5f2ad18bc0ac4cdcd8f2b8&oauth_callback=oob Setting --verbose (verbose) to 1 DEBUG output created by Wget 1.13.4 on linux-gnu.

URI encoding = `UTF-8' --2013-01-26 12:56:14-- https://api.login.yahoo.com/oauth/v2/get_request_token Resolving api.login.yahoo.com (api.login.yahoo.com)... 68.142.197.104 Caching api.login.yahoo.com => 68.142.197.104 Connecting to api.login.yahoo.com (api.login.yahoo.com)|68.142.197.104|:443... connected. Created socket 3. Releasing 0x0000000000c44850 (new refcount 1). Initiating SSL handshake. Handshake successful; connected socket 3 to SSL handle 0x0000000000c44b70 certificate: subject: /C=US/ST=California/L=Santa Clara/O=Yahoo! Inc./OU=Yahoo/CN=*.login.yahoo.com issuer: /C=US/O=Equifax/OU=Equifax Secure Certificate Authority X509 certificate successfully verified and matches host api.login.yahoo.com

---request begin--- POST /oauth/v2/get_request_token HTTP/1.1 User-Agent: Wget/1.13.4 (linux-gnu) Accept: / Host: api.login.yahoo.com Connection: Keep-Alive Content-Type: application/x-www-form-urlencoded Content-Length: 326

---request end--- [POST data: oauth_version=1.0&oauth_nonce=8c76a87ffd3e4f48b53ed4b669b0b35f&oauth_timestamp=1359222974&oauth_consumer_key=dj0yJmk9bkZWbFVOeklYYjZHJmQ9WVdrOVRIaGtaRkpNTTJNbWNHbzlNVE0wTXpjMU9EVTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD1lNQ--&oauth_signature_method=PLAINTEXT&oauth_signature=f1fd94c079d55a6cda5f2ad18bc0ac4cdcd8f2b8&oauth_callback=oob] HTTP request sent, awaiting response... ---response begin--- HTTP/1.1 401 Forbidden Date: Sat, 26 Jan 2013 17:56:14 GMT P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV" WWW-Authenticate: OAuth oauth_problem=signature_invalid Connection: close Transfer-Encoding: chunked Content-Type: application/x-www-form-urlencoded Cache-Control: private

---response end---

HTTP/1.1 401 Forbidden Date: Sat, 26 Jan 2013 17:56:14 GMT P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV" WWW-Authenticate: OAuth oauth_problem=signature_invalid Connection: close Transfer-Encoding: chunked Content-Type: application/x-www-form-urlencoded Cache-Control: private Registered socket 3 for persistent reuse. Skipping 31 bytes of body: [oauth_problem=signature_invalid] done. Authorization failed.

shell returned 6

by
2 Replies
  • Sorry, here is the same output with the formatting fixed:

    Script:

    timestamp="$(date  %s)"
    #nonce=
    key="dj0yJmk9bkZWbFVOeklYYjZHJmQ9WVdrOVRIaGtaRkpNTTJNbWNHbzlNVE0wTXpjMU9EVTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD1lNQ--"
    method=PLAINTEXT
    sig="f1fd94c079d55a6cda5f2ad18bc0ac4cdcd8f2b8"
    callback=oob
    wget -S -d https://api.login.yahoo.com/oauth/v2/get_request_token --post-data="oauth_version=1.0&oauth_nonce=8c76a87ffd3e4f48b53ed4b669b0b35f&oauth_timestamp=$timestamp&oauth_consumer_key=$key&oauth_signature_method=$method&oauth_signature=$sig&oauth_callback=$callback" -v
    
    

    output:

    Setting --post-data (postdata) to oauth_version=1.0&oauth_nonce=8c76a87ffd3e4f48b53ed4b669b0b35f&oauth_timestamp=1359222974&oauth_consumer_key=dj0yJmk9bkZWbFVOeklYYjZHJmQ9WVdrOVRIaGtaRkpNTTJNbWNHbzlNVE0wTXpjMU9EVTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD1lNQ--&oauth_signature_method=PLAINTEXT&oauth_signature=f1fd94c079d55a6cda5f2ad18bc0ac4cdcd8f2b8&oauth_callback=oob
    Setting --verbose (verbose) to 1
    DEBUG output created by Wget 1.13.4 on linux-gnu.
    
    URI encoding = `UTF-8'
    --2013-01-26 12:56:14--  https://api.login.yahoo.com/oauth/v2/get_request_token
    Resolving api.login.yahoo.com (api.login.yahoo.com)... 68.142.197.104
    Caching api.login.yahoo.com => 68.142.197.104
    Connecting to api.login.yahoo.com (api.login.yahoo.com)|68.142.197.104|:443... connected.
    Created socket 3.
    Releasing 0x0000000000c44850 (new refcount 1).
    Initiating SSL handshake.
    Handshake successful; connected socket 3 to SSL handle 0x0000000000c44b70
    certificate:
      subject: /C=US/ST=California/L=Santa Clara/O=Yahoo! Inc./OU=Yahoo/CN=*.login.yahoo.com
      issuer:  /C=US/O=Equifax/OU=Equifax Secure Certificate Authority
    X509 certificate successfully verified and matches host api.login.yahoo.com
    
    ---request begin---
    POST /oauth/v2/get_request_token HTTP/1.1
    User-Agent: Wget/1.13.4 (linux-gnu)
    Accept: */*
    Host: api.login.yahoo.com
    Connection: Keep-Alive
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 326
    
    ---request end---
    [POST data: oauth_version=1.0&oauth_nonce=8c76a87ffd3e4f48b53ed4b669b0b35f&oauth_timestamp=1359222974&oauth_consumer_key=dj0yJmk9bkZWbFVOeklYYjZHJmQ9WVdrOVRIaGtaRkpNTTJNbWNHbzlNVE0wTXpjMU9EVTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD1lNQ--&oauth_signature_method=PLAINTEXT&oauth_signature=f1fd94c079d55a6cda5f2ad18bc0ac4cdcd8f2b8&oauth_callback=oob]
    HTTP request sent, awaiting response... 
    ---response begin---
    HTTP/1.1 401 Forbidden
    Date: Sat, 26 Jan 2013 17:56:14 GMT
    P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"
    WWW-Authenticate: OAuth oauth_problem=signature_invalid
    Connection: close
    Transfer-Encoding: chunked
    Content-Type: application/x-www-form-urlencoded
    Cache-Control: private
    
    ---response end---
    
      HTTP/1.1 401 Forbidden
      Date: Sat, 26 Jan 2013 17:56:14 GMT
      P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"
      WWW-Authenticate: OAuth oauth_problem=signature_invalid
      Connection: close
      Transfer-Encoding: chunked
      Content-Type: application/x-www-form-urlencoded
      Cache-Control: private
    Registered socket 3 for persistent reuse.
    Skipping 31 bytes of body: [oauth_problem=signature_invalid] done.
    Authorization failed.
    
    shell returned 6
    
    0
  • Hey,

    I'm not sure if you've solved this or not. I work with .NET but from what I can see your signature isn't constructed right. If you're using PLAINTEXT then all you need for your signature would be.. ...oauth_signature=f1fd94c079d55a6cda5f2ad18bc0ac4cdcd8f2b8&

    Looks like you're just missing the ampersand character on the end of your oauth signature.

    0

Recent Posts

in OAuth General Discussion YDN SDKs