0

Getting contacts via JAVA

Hi guys.

I've tried and tried for as long as i can rem but i still can't get the contacts of the user.
I'm coding this in JAVA and i managed to go through the painful steps of OAuth to get the auth_token that allows me to call the contact api with the user's permission.

I'm trying to make the following call.

String url = "http://social.yahooapis.com/v1/user/{GUID}/contacts?format=XML";

I've tried add the parameters on the URL QUERY and also in the AUTHORIZATION HEADER. I get different errors.

When i tried via the URL QUERY way,
I receive this error.
<yahoo:description>Please provide valid credentials. OAuth oauth_problem="signature_invalid", realm="yahooapis.com"</yahoo:description>

I'm pretty sure i sign it correctly. Below is my basestring.
QUOTE
GET&http%3A%2F%2Fsocial.yahooapis.com%2Fv1%2Fuser%2FZ46EVC3UWMNTWJLAZPSW6LYYO4%2Fcontacts&format%3DXML
%26oauth_consumer_key%3<CONSUMER_KEY HERE>
%26oauth_nonce%3D1261405635463241000
%26oauth_signature_method%3DHMAC-SHA1
%26oauth_timestamp%3D1261405635
%26oauth_token%3DA%25253DEwIGrWnKvwSa3Uu3LZDJt2hi_kLvsPyizr_lS4.TFT3SM9pOZwEfaOXjk437s0nwe9TRfdVnY7
5yHa0V8fdoGxiQmDooywq0CGgFor9_eKbD2bFh7tvCBhctPzslqJr4rUiym_7ci7dKbjPtZqs48tBmmKL
9CAoAIIsB_jbc1wUQPvQUzY49R.LexY41wGb9A8DgVIjVAEeRD.dssxdQNyXridUmfhvUTKwYc1qZAmdS
WgunMOkAkE5GRK9Fu90iq8Vof4AmiTxAi5ZadyNhNlkBpOmfjtUbivPycpTbVWLyqZ1hmFqP7O8G3rdq1
I14gqUE6ZYaxf70uumF7Zmm1H8esGnmB_rAECJrN5P370Ipt9eurIrsDkD6lMYJ68qYaPJzExPrtVCJCc
Yuz1E7xJRv5NqO8wIk8yLFpeEo.9hGuSiqrfcyBZATda2lNywlzWsfGsIo.DtXJS3i3ko2d3jx7qX24SN
.OQboYDCSDNtQOM3s_.Weemje50Qg.WOpg9mTMBDlxzF82q3x.2TPzv34F5735kZZuvQ17Et5wgkZN5bJ
FHZ8Tg7hpPS2BtCdorKBilA.Zg1qhZVSIXCE_jd8jCqrkhEUJAziUq2xtWt9lId49bHcXam6yhmcacX9T
ZNGX1asmSwacomxmfIADaHRed031wLoXiaIeA6iWnQClfTRSRnVbGsh3wFTNX5WZJ2NrAjX6fiur03cN9
.xQ.q.6lVTUvZ.5nA0_qwP1dO4J3_5h.p2KVUm.tZ47t85h61wsUMzX7L8jSWVcNfBjlNkWsTf_i6Lmzg-
%26realm%3Dyahooapis.com


And i'm signing the above with my <Consumer SECRET> &<OAuthTokenSecret>.

Where did i go wrong? Please some just assist.

by
11 Replies
  • QUOTE (donchen.tinkrbox @ Dec 21 2009, 06:32 AM) <{POST_SNAPBACK}>
    Hi guys.

    I've tried and tried for as long as i can rem but i still can't get the contacts of the user.
    I'm coding this in JAVA and i managed to go through the painful steps of OAuth to get the auth_token that allows me to call the contact api with the user's permission.

    I'm trying to make the following call.

    String url = "http://social.yahooapis.com/v1/user/{GUID}/contacts?format=XML";

    I've tried add the parameters on the URL QUERY and also in the AUTHORIZATION HEADER. I get different errors.

    When i tried via the URL QUERY way,
    I receive this error.
    <yahoo:description>Please provide valid credentials. OAuth oauth_problem="signature_invalid", realm="yahooapis.com"</yahoo:description>

    I'm pretty sure i sign it correctly. Below is my basestring.


    And i'm signing the above with my <Consumer SECRET> &<OAuthTokenSecret>.

    Where did i go wrong? Please some just assist.



    Hi Don,

    As you were able to login a user, how did open the yahoo login window? through javacript? I am having hard time getting a callback after a user logs in.

    Thanks,
    Sharan
    0
  • Come on? No one can help?

    No one ever succeeded in getting the contacts before? !?!
    0
  • QUOTE (donchen.tinkrbox @ Dec 22 2009, 05:02 AM) <{POST_SNAPBACK}>
    Come on? No one can help?

    No one ever succeeded in getting the contacts before? !?!


    Is your problem contacts api specific? It looks like your base string is correct. Can you provide the entire http request/response?
    0
  • Hi! Thanks for responding!! :)anyway, yes. It is contact API specific because I'm trying to call the contact API to retrieve the users email contact list.
    0
  • Just wondering...

    I'm suppose to sign the above with my consumer secret with the token secret I gotten from get auth token right?

    And is the version of the oauth needed as the parameters?
    0
  • QUOTE (donchen.tinkrbox @ Dec 22 2009, 08:43 PM) <{POST_SNAPBACK}>
    Just wondering...

    I'm suppose to sign the above with my consumer secret with the token secret I gotten from get auth token right?

    And is the version of the oauth needed as the parameters?


    Yes, you should sign the request with the consumer key and shared secret you received when creating an oauth app. Yes, you should include the oauth version (we support 1.0a, and no longer support 1.0 due to the session fixation vulnerability).
    0
  • QUOTE (Dustin Whittle @ Jan 4 2010, 05:05 PM) <{POST_SNAPBACK}>
    Yes, you should sign the request with the consumer key and shared secret you received when creating an oauth app. Yes, you should include the oauth version (we support 1.0a, and no longer support 1.0 due to the session fixation vulnerability).

    i fail,too.And,before i decode the accesstoken (sth like 'A%3Dbcu...' decoded to 'A=bcu...') ,i even got the 'token_rejected' error.Now i still got 'signature_invalid'...

    In your document(http://developer.yahoo.com/oauth/guide/oauth-signing.html#oauth-sign-hmac),said "Use the normalized base string as "text" sign it using the concatenated Shared Secret (Consumer Secret) and Token Secret separated by an "&" character. ".
    The sha hash key should be format like this 'Consumer Secret & AcessTokenSecret ' ???
    not " the consumer key and shared secret " !??
    0
  • No one ???

    Anyway, the final step to call the yahoo contact api, can we do it via the query paremeters or only via the authorization header?
    0
  • QUOTE (donchen.tinkrbox @ Dec 24 2009, 06:04 PM) <{POST_SNAPBACK}>
    No one ???

    Anyway, the final step to call the yahoo contact api, can we do it via the query paremeters or only via the authorization header?


    http://developer.yahoo.com/social/rest_api...HTTP-operations

    You can provide the oauth parameters via the query parameters or the authorization header.

    http://developer.yahoo.com/oauth/guide/oau...ke-request.html
    0
  • QUOTE (donchen.tinkrbox @ Dec 24 2009, 06:04 PM) <{POST_SNAPBACK}>
    No one ???

    Anyway, the final step to call the yahoo contact api, can we do it via the query paremeters or only via the authorization header?


    Just wondering if Don was able to get it work? I am facing the same problem: http://developer.yahoo.net/forum/index.php?showtopic=4460
    0
  • I think you could ref from this link : http://lamdaica.com/demo/seeDemo.aspx?id=3&lang=1
    QUOTE (know.test @ Feb 5 2010, 05:14 AM) <{POST_SNAPBACK}>
    Just wondering if Don was able to get it work? I am facing the same problem: http://developer.yahoo.net/forum/index.php?showtopic=4460
    0

Recent Posts

in Contacts