0

cannot connect to contacts API

I've been hacking at this for over an hour and can't seem to get it.

I have successfully completed oauth authentication, but I cannot retrieve anything from the API. This is supposed to be the easy part!

I am trying to get all of my contacts out like this:

http://social.yahooapis.com/v1/user/3Q4WDM...uth_version=1.0

This gives me the error: OAuth oauth_problem="signature_method_rejected", realm="yahooapis.com"

I tried to switch to HMAC-SHA1 method, but I've never done this before and do not know how to construct this (in coldfusion). If I at least knew what input parameters to pass to it I could figure it out.

Anyone know how to deal with this?

by
4 Replies
  • I'm fairly certain the hmac-sha1 signature I am trying to generate is invalid, can anyone explain in detail the process of how to generate a hmac-sha1 signature, preferably in coldfusion?

    I have this:


    <cffunction name="hmacEncrypt" returntype="any" access="public" output="false">
    <cfargument name="signKey" type="string" required="true" />
    <cfargument name="signMessage" type="string" required="true" />

    <cfset var jMsg = JavaCast("string",arguments.signMessage).getBytes("iso-8859-1") />
    <cfset var jKey = JavaCast("string",arguments.signKey).getBytes("iso-8859-1") />

    <cfset var key = createObject("java","javax.crypto.spec.SecretKeySpec") />
    <cfset var mac = createObject("java","javax.crypto.Mac") />

    <cfset key = key.init(jKey,"HmacSHA1") />

    <cfset mac = mac.getInstance(key.getAlgorithm()) />
    <cfset mac.init(key) />
    <cfset mac.update(jMsg) />

    <cfreturn toString(mac.doFinal()) />
    </cffunction>


    But what do i pass in for the argument values???
    0
  • Oh I am so close w/ this code:
    http://pastebin.com/5C1NJcSQ

    But its giving me an error:

    <?xml version='1.0' encoding='utf-8'?> <error xmlns='http://yahooapis.com/v1/base.rng' xml:lang='en'> <description>400 Bad Request</description> <detail>400 Error : syntax error, unexpected INVALIDCHARACTER, expecting ENDOFSEGMENT at "contactsoauth_consumer_key*=*dj0yJmk9SFNyUFZmSTJ0NUl3JmQ9WVdrOWRsVjBjV0pRTl
    djbWNHbzlOVGsyTWpBeU5qWXkmcz1jb25zdW1lcnNlY3JldCZ4PWFm&oauth_signature_method=HMAC-SHA1&oauth_nonce=92C9F07FBCAEC52026B26F8739AC7B04&oauth_timestamp=1305887528&oauth_token=A=XeANel7_kQj2BHVIFF_aFKPp916SoueTyzYTCfANEbumk9iof2JxhrWoQhSu1f
    GNMZ12CCoHcdYcIRVrHwrhchL8i_cETaT.ENurhpakaS51Lv6huVJcomWtBldBJrwVs09XbMT7b90XI3s
    hAejh5BPwy7uQj4W_Xzmx2WWk9S5NCy1UX0.8SERB8S4I84WeASi3PuZ_ARAdmb8mdxien.fvbTvnHchW
    N2FEk3xrDsimJJtWId7XbbyXDjRJXhAJ9Q3WRkouAvTeGNn5Ptdaq7L5id7z7gPMXpUr4jvZr8Pz8hcSS
    YHfySkVUdO00Q0tHaG9JeRwenIm4RR_vIiX7y48WUxElxJbVyk4pT4WIpkqRnVPebfsX0hg5IF3MgfEYs
    MG7EgRh6IAVIdSUMbOuo7f7o4xbYzqaWchxikjkFo4stCW9EQLoHj6Yl4m_T6ktT2UaqhuJ4YRfD8ISKE
    J4.4v8rL7aQVpv9iwyJv2ruo6xY.7zOeTbLWY_OuGed_DTh0SA7WSnJpZ6cNmVdzqjc7_ANwyAv9HAaI_
    7Juw5QKmWGh5_pP9Xv30u4lI1qucYX7Aj7M9HAc2QsGMElE8FuFPZLZ8RM8Y9JOW8Yb8.ghUcIWyoOIre
    SkzWE1RyKVdky1lwLttR604SoSFQPdh2FkRxzsdYlIu1QRNjN3iShAIhejmRr3ol524NxUIN5L3Z9jDwz
    TbOxKeuzVezJq_HvBJ&oauth_version=1.0&oauth_signature=6jNwJNKCM1jQdl6839WrP%2F26oEs%3D&xoauth_lang_pref=en-us&oauth_signature=2d270eb83117b19223d76ecbf209f1130ad8fce8%2632e4ee7ebd92df775fc9de57845f29b67d7627c8" </detail> </error>
    0
  • I've updated my code and my signature text being used to create the hmac-sha1 looks like this:

    GET&http%3A%2F%2Fsocial%2Eyahooapis%2Ecom%2Fv1%2Fuser%2F3Q4WDMFJ7BHQMTXCKSMLH7WGTQ%2Fcontacts
    &oauth%5Fconsumer%5Fkey%3Ddj0yJmk9SFNyUFZmSTJ0NUl3JmQ9WVdrOWRsVjBjV0pRTldjbWNHbzlOVGsyTWpBeU5qWXkmcz1jb2
    5zdW1lcnNlY3JldCZ4PWFm%26oauth%5Fsignature%5Fmethod%3DHMAC%2DSHA1%26oauth%5Fnonce%3D935A9D57BCAEC52026B2E2B536E6E918%26oauth%5Ftimestamp%3D1305888476%26oauth%5Ftoken%3DA%3Dgv9zBJrwmi9lCRT%5F5MUML4m0lel%5Fk0aDTA8SEUZYyh3ERy1VUljdkfFqaB4ozczSCw7pnjuOIgh2hMWLJ9N6ZnYfdH8aOXhVXiCIb%2EtyNg6CxBGjeVqXo1oQbFk3HC4NxNILb4fGSd3FuuhJ79wyGvSGscPCXkrvuLlY9HpNchPnMEk20HdZ
    PtevYEBeWdV1KCd1IWpzJtoUo7Mp%5FyUonHgC4ucelN9605YbInKEkjkaZSNVfcx7VAefXrrXVRW%2EycxOC4it7WWhp6jgXxxXUVmCxRjgno60kCUaHSDb9WZMcJQMbH9SzwEkhzQHLFcIppOV54HjTy4unS
    fksESF3ML%5Frlyv49qdW5twSf4DUMjs6z4bYVqnViHn0Q%5FmtrT847JhO7iNA%2E6QHz3G3uakju6z9Y2VKR6y%5FQ4%5FAcFfYKJ2q80zJgWYqF2vUhKMwZ0b4V6Z%2E2WZF%5FG%5FmtJ21hfpfr9I9ue1bhZZI2Q0YLBPKngwXGPj1tSWRZD6fe6oaz9bpv4QiKgFcSmmcY49wirGdY34hs
    ggdBUwafUVEglb%2EHR4guJXXDqYs%5F58BtcdtBizLGYlYwvpLOdWf7QUcfxJpJPPkG6SwDjfAac%5F4es7CXZOjMdMYZm9GF9pmK%2EIFymqzQSZ7mAid%2ET3LzXheDGh%2E9c%5Fo3bApQBG8OW9jCShGXzaSBl87Aai8YAjxRA5ejXPdepbU5Y7yOfuGS7RMN8%5FTcXD%26oauth%5Fversion%3D1%2E0%26xoauth%5Flang%5Fpref%3Den%2Dus


    still getting invalid response. :(
    0
  • Hi Steve,

    There is a CodeFusion library from here:
    http://oauth.net/code/

    You may want to give it a try.

    Thanks,
    Yu Wang
    Yahoo! Membership Team
    0

Recent Posts

in OAuth General Discussion YDN SDKs