0

https://api.login.yahoo.com/oauth/v2/ get_request_token

When i request to following url ,its not giving any response

https://api.login.yahoo.com/oauth/v2/
get_request_token?oauth_nonce=ce2130523f788f313f76314ed3965ea6
&oauth_timestamp=32773 &oauth_consumer_key=dj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNV
FV5TXpNeU56ZzJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0yNA--
&oauth_signature_method=plaintext
&oauth_signature=b0b43d64af958b472671c624a262caa3a22e006d%26
&oauth_version=1.0
&xoauth_lang_pref="en-us"
&oauth_callback="http://alpha.invox.com/callback"

by
21 Replies
  • Hi,

    The oauth_timestamp in your request doesn't look right.

    If you have access to tool such as wget (http://www.gnu.org/software/wget/)
    or curl (http://curl.haxx.se/), you can construct the post request
    manually with either of the following commands:

    wget -S -d https://api.login.yahoo.com/oauth/v2/get_request_token --post-data="oauth_version=1.0&oauth_nonce=8c76a87ffd3e4f48b53ed4b669b0b35f&oauth_timestamp=1268432350&oauth_consumer_key=dj0yJmk9TUJETmxhUG9WbDlPJmQ9WVdrOWR6Um9kRkl3TXpRbWNHbzlNV
    GszTVRBM05USXhOQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD02MQ--&oauth_signature_method=PLAINTEXT&oauth_signature=821ce9362da7d3d441265e77469a1339c42097612526&oauth_callback=oob"

    curl https://api.login.yahoo.com/oauth/v2/get_request_token -d "oauth_version=1.0&oauth_nonce=8c76a87ffd3e4f48b53ed4b669b0b35f&oauth_timestamp=1268432350&oauth_consumer_key=dj0yJmk9TUJETmxhUG9WbDlPJmQ9WVdrOWR6Um9kRkl3TXpRbWNHbzlNV
    GszTVRBM05USXhOQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD02MQ--&oauth_signature_method=PLAINTEXT&oauth_signature=821ce9362da7d3d441265e77469a1339c42097612526&oauth_callback=oob" -v

    If you see any error, can you please copy the complete HTTP response
    here so we can check why it fails?

    Thanks,
    Yu Wang
    Yahoo! Membership Team
    0
  • Thanks for response

    I calculated timestamp as difference in seconds between 1970 jan 1 and current time

    With that time stamp , i generated MD5 value as nonce

    Here is the request

    https://api.login.yahoo.com/oauth/v2/
    get_request_token?oauth_nonce=65794f79cec40143ed2c48b644d5ae9e
    &oauth_timestamp=1274313599 &oauth_consumer_key=dj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNV
    FV5TXpNeU56ZzJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0yNA--
    &oauth_signature_method=plaintext
    &oauth_signature=b0b43d64af958b472671c624a262caa3a22e006d%26
    &oauth_version=1.0
    &xoauth_lang_pref="en-us"
    &oauth_callback="http://alpha.invox.com/callback


    Still it is not giving any response.

    As i am java developer ,can you suggest ,what is best way to generate time stamp and nonce.


    Thanks
    0
  • wget request
    -----------------
    wget -S -d https://api.login.yahoo.com/oauth/v2/get_request_token --post-data="oauth_version=1.0
    oauth_nonce=7e62239890d813e5fc7abd4ca16b3088&oauth_timestamp=1274345784&oauth_consumer_key=dj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNV
    FV5TXpNeU56ZzJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0yNA--&oauth_signature_method=plaintext&oauth_signature=b0b43d64af958b472671c624a262caa3a22e006d&oauth_version=1.0&xoauth_lang_pref=en-us&oauth_callback=http://alpha.invox.com/callback.jsp"


    This is wget request response
    -------------------------------
    Setting --post-data (postdata) to oauth_version=1.0
    oauth_nonce=7e62239890d813e5fc7abd4ca16b3088&oauth_timestamp=1274345784&oauth_consumer_key=dj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNV
    FV5TXpNeU56ZzJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0yNA--&oauth_signature_method=plaintext&oauth_signature=b0b43d64af958b472671c624a262caa3a22e006d&oauth_version=1.0&xoauth_lang_pref=en-us&oauth_callback=http://alpha.invox.com/callback.jsp
    DEBUG output created by Wget 1.10.2 (Red Hat modified) on linux-gnu.

    --08:59:22-- https://api.login.yahoo.com/oauth/v2/get_request_token
    Resolving api.login.yahoo.com... 68.142.197.104
    Caching api.login.yahoo.com => 68.142.197.104
    Connecting to api.login.yahoo.com|68.142.197.104|:443... connected.
    Created socket 3.
    Releasing 0x0000000002783d30 (new refcount 1).
    Initiating SSL handshake.
    Handshake successful; connected socket 3 to SSL handle 0x00000000027d1c60
    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.0
    User-Agent: Wget/1.10.2 (Red Hat modified)
    Accept: */*
    Host: api.login.yahoo.com
    Connection: Keep-Alive
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 399

    ---request end---
    [POST data: oauth_version=1.0
    oauth_nonce=7e62239890d813e5fc7abd4ca16b3088&oauth_timestamp=1274345784&oauth_consumer_key=dj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNV
    FV5TXpNeU56ZzJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0yNA--&oauth_signature_method=plaintext&oauth_signature=b0b43d64af958b472671c624a262caa3a22e006d&oauth_version=1.0&xoauth_lang_pref=en-us&oauth_callback=http://alpha.invox.com/callback.jsp]
    HTTP request sent, awaiting response...
    ---response begin---
    HTTP/1.1 401 Authorization Required
    Date: Thu, 20 May 2010 08:59:22 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=parameter_absent&oauth_parameters_absent=oauth_nonce
    Connection: close
    Content-Type: application/x-www-form-urlencoded

    ---response end---

    HTTP/1.1 401 Authorization Required
    Date: Thu, 20 May 2010 08:59:22 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=parameter_absent&oauth_parameters_absent=oauth_nonce
    Connection: close
    Content-Type: application/x-www-form-urlencoded
    hs->local_file is: get_request_token (not existing)
    Closed 3/SSL 0x00000000027d1c60
    Authorization failed.
    0
  • There is no '&' between "oauth_version=1.0" and
    "oauth_nonce=7e62239890d813e5fc7abd4ca16b3088".

    That's why it complains oauth_nonce missing.
    0
  • Request:

    wget -S -d https://api.login.yahoo.com/oauth/v2/get_request_token --post-data="oauth_nonce=7819493019364&oauth_timestamp=1274419346&oauth_consumer_key=dj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNV
    FV5TXpNeU56ZzJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0yNA--&oauth_signature_method=plaintext&oauth_signature=b0b43d64af958b472671c624a262caa3a22e006d%26&oauth_version=1.0&xoauth_lang_pref=en-us&oauth_callback=http://alpha.invox.com/callback.jsp"

    Response
    Setting --post-data (postdata) to oauth_nonce=7819493019364&oauth_timestamp=1274419346&oauth_consumer_key=dj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNV
    FV5TXpNeU56ZzJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0yNA--&oauth_signature_method=plaintext&oauth_signature=b0b43d64af958b472671c624a262caa3a22e006d%26&oauth_version=1.0&xoauth_lang_pref=en-us&oauth_callback=http://alpha.invox.com/callback.jsp
    DEBUG output created by Wget 1.10.2 (Red Hat modified) on linux-gnu.

    --05:25:47-- https://api.login.yahoo.com/oauth/v2/get_request_token
    Resolving api.login.yahoo.com... 68.142.197.104
    Caching api.login.yahoo.com => 68.142.197.104
    Connecting to api.login.yahoo.com|68.142.197.104|:443... connected.
    Created socket 3.
    Releasing 0x0000000000ffdd10 (new refcount 1).
    Initiating SSL handshake.
    Handshake successful; connected socket 3 to SSL handle 0x000000000104bc40
    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.0
    User-Agent: Wget/1.10.2 (Red Hat modified)
    Accept: */*
    Host: api.login.yahoo.com
    Connection: Keep-Alive
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 365

    ---request end---
    [POST data: oauth_nonce=7819493019364&oauth_timestamp=1274419346&oauth_consumer_key=dj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNV
    FV5TXpNeU56ZzJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0yNA--&oauth_signature_method=plaintext&oauth_signature=b0b43d64af958b472671c624a262caa3a22e006d%26&oauth_version=1.0&xoauth_lang_pref=en-us&oauth_callback=http://alpha.invox.com/callback.jsp]
    HTTP request sent, awaiting response...
    ---response begin---
    HTTP/1.1 401 Forbidden
    Date: Fri, 21 May 2010 05:25:47 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
    Content-Type: application/x-www-form-urlencoded

    ---response end---

    HTTP/1.1 401 Forbidden
    Date: Fri, 21 May 2010 05:25:47 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
    Content-Type: application/x-www-form-urlencoded
    hs->local_file is: get_request_token (not existing)
    Closed 3/SSL 0x000000000104bc40
    Authorization failed.


    Why it saying signature_invalid?

    My Shared secret(known as the Consumer Secret in OAuth):b0b43d64af958b472671c624a262caa3a22e006d

    I used consumer secret as signature




    QUOTE (omiga @ May 20 2010, 09:22 AM) <{POST_SNAPBACK}>
    There is no '&' between "oauth_version=1.0" and
    "oauth_nonce=7e62239890d813e5fc7abd4ca16b3088".

    That's why it complains oauth_nonce missing.
    0
  • Hi,

    I saw your another post which said you got the access token already.
    Is this still an issue?

    Thanks,
    Yu Wang
    0
  • Hi,

    I got the access token.

    After getting access token and guid of the user , i am trying to get yahoo contacts.

    Following is the request:

    http://social.yahooapis.com/v1/user/UMGWPD...95809bae6e22771


    Resposne:

    <yahoo:error xml:lang="en-US">

    <yahoo:description>
    Please provide valid credentials. OAuth oauth_problem="unable_to_determine_oauth_type", realm="yahooapis.com"
    </yahoo:description>
    </yahoo:error>



    Can you please tell what is the problem with my request?

    Thanks

    QUOTE (omiga @ May 21 2010, 09:37 AM) <{POST_SNAPBACK}>
    Hi,

    I saw your another post which said you got the access token already.
    Is this still an issue?

    Thanks,
    Yu Wang
    0
  • Hi,

    You should send the Authorization and realm in the HTTP request
    header, not in the query:
    http://developer.yahoo.com/oauth/guide/oau...ke-request.html

    You may also want to check the OAuth spec:
    http://oauth.net/core/1.0a/#auth_header

    Thanks,
    Yu Wang
    0
  • Hi,

    I tried adding oauth parameters in header , still it is giving same error response.

    Here is my sample java code:

    ===========================================

    String nonce = OAuthUtil.getNonce();

    String timestamp = OAuthUtil.getTimestamp();

    String CONSUMER_KEY = "dj0yJmk9UmNNcHhMRE1EYW43JmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNVFV5TXpNeU56ZzJNZy0
    tJnM9Y29uc3VtZXJzZWNyZXQmeD00ZA--";


    String oauth_token = "A%3DJWI0SRDOhQ_rh.UtfJ7sGSlggNZocZedLUfpoa8WVy8D4.wavzf.DqED3QayhmtONJ0RlvR9.dlWty
    GXGUuGOUh1NOGDsnHZt3d9KPxanG9uwRaeO3bSSSv.kCLB8I25T12mxUJG7Y1dyYW7BB0oSlclVHhHjmD
    qU1mtHyAW5St2vlaOOcxI48SJfg1xtyoO9e.9BNGuQH8hinuJ70rHS3om07C9nkwSl29iDOQu1fudj6Ry
    cjzew6XF.9C8b4.pKFGnGwPaB0tsKnCgAzIxakBk6_LCP46yZR0J2PSUSgGFqsv7DliG0tLkbzWmx_UZE
    srG5RBnxnVb8vclGdm_5P6SHt4x5jWwgKEo3zwBYcZ.iS1aRK5SBhyyLXx0PoQE1NRvhEOsg48EHPinxy
    L6rLTHapKfOhqQ5S4uzgYF7zk3vFLrhoeK.ubvMACm7ZUhqMy6bbM_x66x1pRD6qwtLPHKp_W.twixxix
    ORfgXL4UE5VuHVbypKT5QmNGsnQvK4BmdlmmhVOKTfw_Uihe.4jEEdrTQ3QZEET.Hb6hGUc4OMoUwTEuL
    mmPGzY0J1jttKoL5TjUlZ0u5TaGitAHSVRzZu08wuiP41lSZApwNnEhqExewjEY_9tVV6M7Bm1w8GNhmZ
    yW_2Yar9ZYd.1ghmztHhdHgm5d7DHk49YcoHYlaSDvHP0blO9Flol6GDpctSmbJGuBokdgSGTGS7w--";

    String oauth_token_secret = "bf31dc0efbb3200fec4359e389daad1fdf2e7735&039bd26eef3c5e8f40afa9773c2c70f1885401f7";//shared secret & token secret


    String getContactURL = "http://social.yahooapis.com/v1/user/UMGWPDQHM7O4X6ZQO7GDBHM6CU/contacts?format=json";




    HttpClient client1 = new HttpClient();

    OAuthParameters oauthparams = new OAuthParameters();
    oauthparams.setOAuthConsumerKey(CONSUMER_KEY);

    oauthparams.setOAuthNonce(nonce);
    oauthparams.setOAuthTimestamp(timestamp);
    oauthparams.setOAuthSignatureMethod("HMAC-SHA1");
    oauthparams.setOAuthToken(oauth_token);
    oauthparams.setOAuthTokenSecret(oauth_token_secret);

    oauthparams.setRealm("yahooapis.com");




    System.out.println("****getBaseParameters****"+oauthparams.getBaseParameters());

    String baseString = OAuthUtil.getSignatureBaseString(getContactURL,"GET", oauthparams.getBaseParameters());

    System.out.println("****baseString****"+baseString);

    OAuthHmacSha1Signer sgner = new OAuthHmacSha1Signer();

    String signature = (sgner.getSignature(getContactURL, oauthparams));
    oauthparams.setOAuthSignature(signature);

    System.out.println("****signature****"+signature);



    HttpClient client = new HttpClient();
    GetMethod method = new GetMethod(getContactURL);



    String heeaderInfo = "OAuth realm=\"yahooapis.com\",oauth_consumer_key=\"dj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNVFV5TXpNeU56ZzJNZy0
    tJnM9Y29uc3VtZXJzZWNyZXQmeD0yNA--\",oauth_nonce=\""+nonce+"\",oauth_signature_method=\"HMAC-SHA1\",oauth_timestamp=\""+timestamp+"\",oauth_token =\""+oauth_token+"\",oauth_version = \"1.0\",oauth_signature = \""+signature+"\"";
    Header header = new Header();
    header.setName("Authorization");
    header.setValue(heeaderInfo);
    method.addRequestHeader(header);
    System.out.println("header "+method.getRequestHeader("Authorization"));



    // Send GET request
    int statusCode = client.executeMethod(method);

    if (statusCode != HttpStatus.SC_OK) {
    System.err.println("Method failed: " + method.getStatusLine());
    }
    InputStream rstream = null;

    // Get the response body
    rstream = method.getResponseBodyAsStream();

    // Process the response from Yahoo! Web Services
    BufferedReader br = new BufferedReader(new InputStreamReader(rstream));
    String line;
    while ((line = br.readLine()) != null) {
    System.out.println(line);
    }
    br.close();
    }
    =============================================================


    Can you please sort out this issue.



    QUOTE (omiga @ May 24 2010, 09:18 AM) <{POST_SNAPBACK}>
    Hi,

    You should send the Authorization and realm in the HTTP request
    header, not in the query:
    http://developer.yahoo.com/oauth/guide/oau...ke-request.html

    You may also want to check the OAuth spec:
    http://oauth.net/core/1.0a/#auth_header

    Thanks,
    Yu Wang
    0
  • Hi,

    I set the header as

    Authorization: OAuth realm="yahooapis.com",oauth_consumer_key="dj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNVFV5TXpNeU56ZzJNZy0
    tJnM9Y29uc3VtZXJzZWNyZXQmeD0yNA--",oauth_nonce="34644500038412",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1274792304",oauth_token ="A%3DAIC1f5DHvwpKjyCreSBHrdE05FydRnXvjMjeiohx4YUUHz18enYwAB6kP7sJCcPY10CdbeOofjMqD9
    OrghfWKgdXA5OzB92uKSUrW4VsaTyONg8xxnkDdmyTm0qY87FKNPczF5WGA2x7RqFcxfgn_EYo4.DNhb4
    EG7fTTEEXvZax_bQJ8ukAVv6OclMI16muxcBuihiGxuxt8E1.Q5f8S8rq4Y2qsDDJAkwnfv74OXM_5Z3w
    v8u.2KeIRMz8X6Ard0lSQ0g0UUturKvtJytr4.Mh77Mo4Tq6sQStVYocKV5Vt.q7SwsdlOreh2Jk_D3yb
    FqT44RFB9W7LMFkQrqqyLZEJzhuEjA6BU5bylfWWAZ67OcVoRM45KiurrDvQ0mF.xZ2OnXM43ANm8GJ04
    linapYjo0NrYdQitmmlDjMlF8hzy.MgHl7n5X_nm7fzIG8mDZrnXSnes837KIDj9uqIPVeuRtx62CgszS
    Ag.PK2j2s9vzRNSVw6ICa2thdC1l7cVNwx.TtyZv7Z.Xo9bv1vaHALd7pTAgMHZ6zNW2DeoDFZLscbXqK
    n8RYtHILU2.MgNfR0Kf0H6cvSNUHWrDqRqEQGpyf7HTthxvmtt1ymysHWQdATCSj_BagjOMI07tF3QwLB
    tdfqNSd2Lc.KuvsllPG8VyvLCfLWawnC64nQGDeLyKGp20OtCogTq.8Q.xyBS6OZB6mZpUQlzwh4A--",oauth_version = "1.0",oauth_signature = "GdJP7NbKTArkruEiFyUwI5YlJvE%3D"

    URL: http://social.yahooapis.com/v1/user/{guid}/contacts?

    when i request above url using GET method,it giving error.

    error:
    <?xml version='1.0' encoding='UTF-8'?>
    <yahoo:error xmlns:yahoo='http://yahooapis.com/v1/base.rng'
    xml:lang='en-US'>
    <yahoo:description>Please provide valid credentials. OAuth oauth_problem="unable_to_determine_oauth_type", realm="yahooapis.com"</yahoo:description>
    </yahoo:error>

    Please help me to fix this issue.
    0
  • Hi,

    Can you please try it with wget and copy the complete request and response
    headers?

    wget -S -d 'http://social.yahooapis.com/v1/user/YOURGUID/contacts?format=json' --header='Authorization: OAuth realm="yahooapis.com",oauth_consumer_key="dj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNVFV5TXpNeU56ZzJNZy0
    tJnM9Y29uc3VtZXJzZWNyZXQmeD0yNA--",oauth_nonce="34644500038412",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1274792304",oauth_token="A%3DAIC1f5DHvwpKjyCreSBHrdE05FydRnXvjMjeiohx4YUUHz18enYwAB6kP7sJCcPY10CdbeOofjMqD9
    OrghfWKgdXA5OzB92uKSUrW4VsaTyONg8xxnkDdmyTm0qY87FKNPczF5WGA2x7RqFcxfgn_EYo4.DNhb4
    EG7fTTEEXvZax_bQJ8ukAVv6OclMI16muxcBuihiGxuxt8E1.Q5f8S8rq4Y2qsDDJAkwnfv74OXM_5Z3w
    v8u.2KeIRMz8X6Ard0lSQ0g0UUturKvtJytr4.Mh77Mo4Tq6sQStVYocKV5Vt.q7SwsdlOreh2Jk_D3yb
    FqT44RFB9W7LMFkQrqqyLZEJzhuEjA6BU5bylfWWAZ67OcVoRM45KiurrDvQ0mF.xZ2OnXM43ANm8GJ04
    linapYjo0NrYdQitmmlDjMlF8hzy.MgHl7n5X_nm7fzIG8mDZrnXSnes837KIDj9uqIPVeuRtx62CgszS
    Ag.PK2j2s9vzRNSVw6ICa2thdC1l7cVNwx.TtyZv7Z.Xo9bv1vaHALd7pTAgMHZ6zNW2DeoDFZLscbXqK
    n8RYtHILU2.MgNfR0Kf0H6cvSNUHWrDqRqEQGpyf7HTthxvmtt1ymysHWQdATCSj_BagjOMI07tF3QwLB
    tdfqNSd2Lc.KuvsllPG8VyvLCfLWawnC64nQGDeLyKGp20OtCogTq.8Q.xyBS6OZB6mZpUQlzwh4A--",oauth_version="1.0",oauth_signature="GdJP7NbKTArkruEiFyUwI5YlJvE%3D"'

    Thanks,
    Yu Wang
    0
  • Hi,

    Thanks for your response.

    As you said , i tried with wget ,and i am sending request and response.

    Request:
    ===========================
    wget -S -d 'http://social.yahooapis.com/v1/user/YOURGUID/contacts?format=json' --header='Authorization: OAuth realm="yahooapis.com",oauth_consumer_key="dj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNVFV5TXpNeU56ZzJNZy0
    tJnM9Y29uc3VtZXJzZWNyZXQmeD0yNA--",oauth_nonce="8613480710000001",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1274851673",oauth_token="A%3DrnJFuPnmiQ2sLoHFQ_IzQDkizQ1v_Z8G3c0FlxovCn.pr29ruNq.1UaDuBpxNCHMUkTAoqJNSokT59
    T4eo6r.H5mDciwQLNrp_ZfomvPbEVZxSR7vt767Vo9EbFYCs39jOmKlRGgTNLJA8WQZjoG9shRRDEHfOO
    ChbtDMrbauEV8EHjdpdci7OAFHmiSIHSx5IVX6eiOMpe2acQjkc71y8XpWpD.I2Hu75OkgCrZMcAWappL
    c0UokZ7s6zmwy2KVWpDqHyYTRc8OisXiJsvO02uT4v9QeM7nExMdVPbqwcRr.WMV3KSImmYr59Kjd5_p2
    5tVbjTeuIZskU5mCFJbPmS.UIVs9JoyJNkR9Q9K9Fs_IeptdeboFP0YSWinu.2xvBIb7W5GBhi1SDWbQe
    6rLQvRY8x495dhMgVBjuCzziqu2rYpI2dyZ4PwmqRo4lRb6gVXz_QDzlUv4BnON5MOkUZvi4a7x.LgzOr
    dZZ7TNCzKXyJN5P_a3VyNPXwNicfs9SsPrm8tYItPmcLHVgvMs3vdWVw49U4Xsu4j61GsufLf343.hFcv
    iuhMx9djzDK3VWveEjeFGmyq3gFZQtNdEUNwYEEPL3mOzvWqE7azVaihwp7suw4djcOLmk1Dv_XyC2sWV
    qQ92lhD2.Oiclomqxa6X6cSqcbOGGloGNRRl9DFlHM7Cjv0daTp73nsZ4tTJA5WAjKKpbuklaCx4A--",oauth_version="1.0",oauth_signature="9kqK14Cu1EN2IeIOY0bnF6L6GGc="'
    =================================

    Response:
    =======================
    Setting --header (header) to Authorization: OAuth realm="yahooapis.com",oauth_consumer_key="dj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNVFV5TXpNeU56ZzJNZy0
    tJnM9Y29uc3VtZXJzZWNyZXQmeD0yNA--",oauth_nonce="8613480710000001",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1274851673",oauth_token="A%3DrnJFuPnmiQ2sLoHFQ_IzQDkizQ1v_Z8G3c0FlxovCn.pr29ruNq.1UaDuBpxNCHMUkTAoqJNSokT59
    T4eo6r.H5mDciwQLNrp_ZfomvPbEVZxSR7vt767Vo9EbFYCs39jOmKlRGgTNLJA8WQZjoG9shRRDEHfOO
    ChbtDMrbauEV8EHjdpdci7OAFHmiSIHSx5IVX6eiOMpe2acQjkc71y8XpWpD.I2Hu75OkgCrZMcAWappL
    c0UokZ7s6zmwy2KVWpDqHyYTRc8OisXiJsvO02uT4v9QeM7nExMdVPbqwcRr.WMV3KSImmYr59Kjd5_p2
    5tVbjTeuIZskU5mCFJbPmS.UIVs9JoyJNkR9Q9K9Fs_IeptdeboFP0YSWinu.2xvBIb7W5GBhi1SDWbQe
    6rLQvRY8x495dhMgVBjuCzziqu2rYpI2dyZ4PwmqRo4lRb6gVXz_QDzlUv4BnON5MOkUZvi4a7x.LgzOr
    dZZ7TNCzKXyJN5P_a3VyNPXwNicfs9SsPrm8tYItPmcLHVgvMs3vdWVw49U4Xsu4j61GsufLf343.hFcv
    iuhMx9djzDK3VWveEjeFGmyq3gFZQtNdEUNwYEEPL3mOzvWqE7azVaihwp7suw4djcOLmk1Dv_XyC2sWV
    qQ92lhD2.Oiclomqxa6X6cSqcbOGGloGNRRl9DFlHM7Cjv0daTp73nsZ4tTJA5WAjKKpbuklaCx4A--",oauth_version="1.0",oauth_signature="9kqK14Cu1EN2IeIOY0bnF6L6GGc="
    DEBUG output created by Wget 1.10.2 (Red Hat modified) on linux-gnu.

    --05:30:50-- http://social.yahooapis.com/v1/user/YOURGU...cts?format=json
    Resolving social.yahooapis.com... 68.142.215.20
    Caching social.yahooapis.com => 68.142.215.20
    Connecting to social.yahooapis.com|68.142.215.20|:80... connected.
    Created socket 3.
    Releasing 0x00000000015a3650 (new refcount 1).

    ---request begin---
    GET /v1/user/YOURGUID/contacts?format=json HTTP/1.0
    User-Agent: Wget/1.10.2 (Red Hat modified)
    Accept: */*
    Host: social.yahooapis.com
    Connection: Keep-Alive
    Authorization: OAuth realm="yahooapis.com",oauth_consumer_key="dj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNVFV5TXpNeU56ZzJNZy0
    tJnM9Y29uc3VtZXJzZWNyZXQmeD0yNA--",oauth_nonce="8613480710000001",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1274851673",oauth_token="A%3DrnJFuPnmiQ2sLoHFQ_IzQDkizQ1v_Z8G3c0FlxovCn.pr29ruNq.1UaDuBpxNCHMUkTAoqJNSokT59
    T4eo6r.H5mDciwQLNrp_ZfomvPbEVZxSR7vt767Vo9EbFYCs39jOmKlRGgTNLJA8WQZjoG9shRRDEHfOO
    ChbtDMrbauEV8EHjdpdci7OAFHmiSIHSx5IVX6eiOMpe2acQjkc71y8XpWpD.I2Hu75OkgCrZMcAWappL
    c0UokZ7s6zmwy2KVWpDqHyYTRc8OisXiJsvO02uT4v9QeM7nExMdVPbqwcRr.WMV3KSImmYr59Kjd5_p2
    5tVbjTeuIZskU5mCFJbPmS.UIVs9JoyJNkR9Q9K9Fs_IeptdeboFP0YSWinu.2xvBIb7W5GBhi1SDWbQe
    6rLQvRY8x495dhMgVBjuCzziqu2rYpI2dyZ4PwmqRo4lRb6gVXz_QDzlUv4BnON5MOkUZvi4a7x.LgzOr
    dZZ7TNCzKXyJN5P_a3VyNPXwNicfs9SsPrm8tYItPmcLHVgvMs3vdWVw49U4Xsu4j61GsufLf343.hFcv
    iuhMx9djzDK3VWveEjeFGmyq3gFZQtNdEUNwYEEPL3mOzvWqE7azVaihwp7suw4djcOLmk1Dv_XyC2sWV
    qQ92lhD2.Oiclomqxa6X6cSqcbOGGloGNRRl9DFlHM7Cjv0daTp73nsZ4tTJA5WAjKKpbuklaCx4A--",oauth_version="1.0",oauth_signature="9kqK14Cu1EN2IeIOY0bnF6L6GGc="

    ---request end---
    HTTP request sent, awaiting response...
    ---response begin---
    HTTP/1.0 401 Authorization Required
    Date: Wed, 26 May 2010 05:30:50 GMT
    WWW-Authenticate: OAuth oauth_problem="signature_invalid", realm="yahooapis.com"
    Vary: Accept-Encoding
    Content-Type: application/json
    Age: 0
    Connection: close
    Via: HTTP/1.1 r5.ycpi.mud.yahoo.net (YahooTrafficServer/1.18.5 [cMsSf ])
    Server: YTS/1.18.5

    ---response end---

    HTTP/1.0 401 Authorization Required
    Date: Wed, 26 May 2010 05:30:50 GMT
    WWW-Authenticate: OAuth oauth_problem="signature_invalid", realm="yahooapis.com"
    Vary: Accept-Encoding
    Content-Type: application/json
    Age: 0
    Connection: close
    Via: HTTP/1.1 r5.ycpi.mud.yahoo.net (YahooTrafficServer/1.18.5 [cMsSf ])
    Server: YTS/1.18.5
    hs->local_file is: contacts?format=json (not existing)
    Closed fd 3
    Authorization failed.
    ==============================================


    I generated signature as follows

    OAuthParameters oauthparams = new OAuthParameters();
    oauthparams.setOAuthConsumerKey(CONSUMER_KEY);
    oauthparams.setOAuthConsumerSecret(CONSUMER_SECRET);
    oauthparams.setOAuthNonce(nonce);
    oauthparams.setOAuthSignatureMethod("HMAC-SHA1");
    oauthparams.setOAuthTimestamp(timestamp);
    oauthparams.setOAuthToken(oauth_token);
    oauthparams.setOAuthTokenSecret(oauth_token_secret);
    oauthparams.setRealm("yahooapis.com");


    OAuthHmacSha1Signer sgner = new OAuthHmacSha1Signer();
    String signature = (sgner.getSignature(baseString, oauthparams));
    oauthparams.setOAuthSignature(signature);



    Is this correct way to generate signature. If not can you suggest me how to generate signature.


    I have some doubt on my consumer secret i.e.

    In my account it is showing as "74f8e3730329e2c0007d3680b9addeb1940ddf82" which is generated today.

    My previous consumer secret is "bf31dc0efbb3200fec4359e389daad1fdf2e7735".

    If i use new consumer secret ,it is saying signature invalid for request token,access token.

    If i use old consumer secret , i am able to get request token and access token.

    Which one is my consumer secret ,whether it is old one or new one?

    And how generate signature for accessing yahoo contact API?

    Please suggest me.

    Thanks in Advance
    0
  • Did you modify the scopes for your consumer key? I think a better
    way is to create a new consumer key so that you can rule out
    the possibility that you have a wrong secret.

    Can you please copy the signature base string over here?
    http://oauth.net/core/1.0a/#anchor21

    Thanks,
    Yu Wang
    0
  • Hi,

    Thanks for your response.

    Yes , i modified my scope.

    I deleted my previous project and created new project. Now my new consumer secret is working fine to get access token .

    Still i am unable to fetch yahoo contacts ,it is giving signature invalid error.

    I constructed signature following ways,but no luck.

    My base string is

    GET&http%3A%2F%2Fsocial.yahooapis.com%2Fv1%2Fuser%2FUMGWPDQHM7O4X6ZQO7GDBHM6CU%2Fcontacts&oauth_consumer_key%3Ddj0yJmk9Nk1YdU55TWdiTjVkJmQ9WVdrOWNtbEJRVTVyTnpRbWNHbzlNVFV5TXpNeU56ZzJNZy0tJn
    M9Y29uc3VtZXJzZWNyZXQmeD0yNA--%26oauth_nonce%3D8695106220000001%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1274933298%26oauth_token%3DA%25253Dh_wtpZr.vzAr2n76eD1jGfkogrSZ8tJ9vHreFw4X5bHetdxmb79wLaUoClILtFo1s1F_UBaKWa
    0YO34Ge5x.Gr0SvA5Aw55g_JvffFLTFs.Zsrg77JcYD.2lDHTmKTBKCY0Q.ewZv03JlhKeTCeDAsk.i.8
    427XEgIMs2H5CIeqEE9zFeyGR_vM6u2Rsi6na6B4mjIF.mRtyUnQm1Jjq7OwiPrZ3IfXLam1CoE6cozFf
    cmRKbyHzSSvYH4.uuEZA6WU1V5EJTTwrsa3jlC7JWzxdwFtGKt0_G14S3A1V4XxqUbY7_PpUMNcKFJzJ5
    VUsMKh6SuwIDk88fUYf8w8RXZkabZlrm27AqJJUobF_CTeAgqSHi8gWGfuqkRdiub_RAcQ7.h9YiY6YQE
    CMvJqbkc.zqmI4SV9JtZIBjN27BhU9CkkGc4QMVJ9gtLxeAQoynBfl1TLTAGHnSatNkzFPV0xM9Fi80nx
    cW3qembAaTHHggu8wRQrl2Tc4ZUBm7YF5cXtcV04SKquI8fmVRoN0lAnaMk1jePRknjSpRulNkJpmKmYY
    .OxqQHW1KwoJ9EvTAkJ8jLnZCtKnq3Mo6hRoRLz.4feulwTSvAu6rwfoB9gEyUN2qy5n0ddhoCJldbwrT
    wwdwlNRrK4SQJbtsRqTrl9fiKbwz7t_.Srpye5q3csCArvvMii9zFpWkyHl8vPEULHw774-



    1) signature = CONSUMER SECRET+&+Access Token secret

    2) signature =

    SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), "HmacSHA1");
    Mac mac = Mac.getInstance("HmacSHA1");
    mac.init(signingKey);

    byte[] rawHmac = mac.doFinal(baseString.getBytes());
    signature = new String(Base64.encodeBase64(rawHmac));


    3) signature =

    String getContactURL = "http://social.yahooapis.com/v1/user/{guid}/contacts";

    OAuthParameters oauthparams = new OAuthParameters();
    oauthparams.setOAuthConsumerKey(CONSUMER_KEY);
    oauthparams.setOAuthConsumerSecret(CONSUMER_SECRET);
    oauthparams.setOAuthNonce(nonce);
    oauthparams.setOAuthSignatureMethod("HMAC-SHA1");
    oauthparams.setOAuthTimestamp(timestamp);
    oauthparams.setOAuthToken(oauth_token);
    oauthparams.setOAuthTokenSecret(oauth_token_secret);
    oauthparams.setRealm("yahooapis.com");



    OAuthHmacSha1Signer sgner = new OAuthHmacSha1Signer();
    String signature = (sgner.getSignature(getContactURL, oauthparams))

    I am unable to solve this issue.

    Is there any api to generate signature for yahoo?

    I seen in this forum ,so many developers facing this problem .

    Even i tried with wget ,it giving same response.

    Please help me , how can i generate signature ?





    QUOTE (omiga @ May 26 2010, 09:59 AM) <{POST_SNAPBACK}>
    Did you modify the scopes for your consumer key? I think a better
    way is to create a new consumer key so that you can rule out
    the possibility that you have a wrong secret.

    Can you please copy the signature base string over here?
    http://oauth.net/core/1.0a/#anchor21

    Thanks,
    Yu Wang
    0
  • Hi,

    When you construct the signature base string, you also need to
    include all the other query parameters. In this case, it is "format=json"
    and you need to order them properly.

    Please check the spec for example:
    http://oauth.net/core/1.0a/#sig_base_example

    Thanks,
    Yu Wang
    0
  • Hi,

    I used oauth_signature_method as "plain-text" for getting the

    1) request token

    2) verify

    3) access token.

    I am able to get access token ,access token secret and customer guid .

    After getting all the required parameters , i am sending request to yahoo contacts api.

    To access yahoo contacts api, we need generate signature using "HMAC-SHA1".

    My baseString :

    POST&https%3A%2F%2Fapi.login.yahoo.com%2Foauth%2Fv2%2Fget_request_token&oauth_callback%3Dhttp%253A%252F%252Falpha.invox.com%252Fcallback.jsp%26oauth_consumer_key%3Ddj0yJmk9MlZhV2dRYmRZY1NrJmQ9WVdrOVRWRTVjR2RqTlRnbWNHbzlOakF4TWpVNE5qSS0mcz1jb2
    5zdW1lcnNlY3JldCZ4PWIw%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1275484474%26oauth_version%3D1.0%26xoauth_lang_pref%3Den-us

    String key = Consumer Secret+"&"+access token secret

    signature = Signature.calculateRFC2104HMAC(yahoobaseString,key);

    I am sending all the parameter in header.

    I am always getting signature_invalid error.

    Can you please suggest to get yahoo contatcs?

    Is there any libary file to get the contacts?

    Thanks













    QUOTE (omiga @ May 27 2010, 11:21 AM) <{POST_SNAPBACK}>
    Hi,

    When you construct the signature base string, you also need to
    include all the other query parameters. In this case, it is "format=json"
    and you need to order them properly.

    Please check the spec for example:
    http://oauth.net/core/1.0a/#sig_base_example

    Thanks,
    Yu Wang
    0
  • Hi,

    Sorry , my above reply has some mistakes.

    I am trying to get request token using "HMAC-SHA1" alog. I got request token , access token and customer guid using plaintext.


    To get request token, we need generate signature using "HMAC-SHA1".

    My baseString :

    POST&https%3A%2F%2Fapi.login.yahoo.com%2Foauth%2Fv2%2Fget_request_token&oauth_callback%3Dhttp%253A%252F%252Falpha.invox.com%252Fcallback.jsp%26oauth_consumer_key%3Ddj0yJmk9MlZhV2dRYmRZY1NrJmQ9WVdrOVRWRTVjR2RqTlRnbWNHbzlOakF4TWpVNE5qSS0mcz1jb2
    5zdW1lcnNlY3JldCZ4PWIw%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1275484474%26oauth_version%3D1.0%26xoauth_lang_pref%3Den-us

    String key = Consumer Secret+"&";

    signature = Signature.calculateRFC2104HMAC(yahoobaseString,key);

    I am always getting signature_invalid error.

    Can you please suggest, how i can get yahoo contatcs?

    Is there any libary file which well help us to get the contacts?

    Thanks
    0
  • Hi,

    I don't see oauth_nonce in your signature base string.

    You can see code examples for HMAC-SHA1 from
    http://oauth.net/code/

    Thanks,
    Yu Wang
    0
  • Hi,

    when i have sending the callback variable to url its given Oauth error.But when i am using $callback='oob' its working.
    0
  • Hi,

    I m getting error, while getting profile for yahoo

    An error occurred while parsing profile data.
    Provider returned: <?xml version="1.0" encoding="utf-8"?><profile xmlns="http://social.yahooapis.com/v1/schema.rng" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:uri="http://social.yahooapis.com/v1/user/3AUCWNKKJAY4RRNDQ7AETCTB3M/profile"><guid>3AUCWNKKJAY4RRNDQ7AETCTB3M</guid><created>2009-10-16T02:52:54Z</created><gender>M</gender><image><height>192</height><imageUrl>http://l.yimg.com/a/i/identity2/profile_192a.png</imageUrl><size>192x192</size><width>192</width></image><location>Ahmedabad</location><memberSince>2007-01-21T16:15:21Z</memberSince><nickname>samir</nickname><profileUrl>http://profile.yahoo.com/3AUCWNKKJAY4RRNDQ7AETCTB3M</profileUrl><searchable>true</searchable><updated>2012-07-16T10:41:59Z</updated><isConnected>false</isConnected></profile>

    0
  • Hi,
     
    i m getting error in getting yahoo profile...

    An error occurred while parsing profile data.
    Provider returned: <?xml version="1.0" encoding="utf-8"?><profile xmlns="http://social.yahooapis.com/v1/schema.rng" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:uri="http://social.yahooapis.com/v1/user/3AUCWNKKJAY4RRNDQ7AETCTB3M/profile"><guid>3AUCWNKKJAY4RRNDQ7AETCTB3M</guid><created>2009-10-16T02:52:54Z</created><gender>M</gender><image><height>192</height><imageUrl>http://l.yimg.com/a/i/identity2/profile_192a.png</imageUrl><size>192x192</size><width>192</width></image><location>Ahmedabad</location><memberSince>2007-01-21T16:15:21Z</memberSince><nickname>samir</nickname><profileUrl>http://profile.yahoo.com/3AUCWNKKJAY4RRNDQ7AETCTB3M</profileUrl><searchable>true</searchable><updated>2012-07-16T10:41:59Z</updated><isConnected>false</isConnected></profile>

    0

Recent Posts

in OAuth General Discussion YDN SDKs