credential problem

Hi, I'm new to the Yahoo APIs, so sorry in advance if this is a common question. I'm trying to programmatically connect to the new firehose API. I used the console to build a test query and it gave me the url:


I then went and created a project with a consumer key of type "OAuth Application" with permissions set to

"All public APIs, Web Services, or RSS feeds including those provided by Yahoo!"

key = "dj0yJmk9Z2VMcG9TTXpuRXMyJmQ9WVdrOVdFSm1lVWs0TkRJbWNHbzlNakV4TURRMU5EWTJNZy0

But when I plug the key, the secret & the url into some existing oauth code, that works with other endpoints, I get back an error message:

<yahoo:description>Please provide valid credentials</yahoo:description>

If you can deal with a Ruby object dump, the request object looks like:

>> request.to_hash
=> {"accept"=>["*/*"], "user-agent"=>["OAuth gem v0.3.6"], "connection"=>["close"], "authorization"=>["OAuth oauth_nonce=\"d0D4DyugcpjDYfPAUVy6gPHbhlkP0gCCdyuMdxavwk\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1271877158\", oauth_consumer_key=\"dj0yJmk9Z2VMcG9TTXpuRXMyJmQ9WVdrOVdFSm1lVWs0TkRJbWNHbzlNakV4TURRMU5EWTJNZy0
tJnM9Y29uc3VtZXJzZWNyZXQmeD0zNA--\", oauth_signature=\"ycm5V%2BXmdU861gMc%2Fn53FWlZPF8%3D\", oauth_version=\"1.0\""], "host"=>["query.yahooapis.com"]}

Oddly, I get the exact same error message if I try to load that url via curl without any oauth at all.

Any ideas what I'm doing wrong?


3 Replies
  • Hi Chris,

    I've tried w/ a couple different libraries in ruby (incl http://github.com/mojodna/oauth ) and js, and think it might be on our side. Would you mind trying w/ a different 2-leg oauth API, like Photobucket's login token request ( http://photobucket.com/developer , http://pic.pbsrc.com/dev_help/WebHelpPubli...tPublicHelp.htm ) as a sanity check?

    Can you successfully fetch a Y! request token ( http://developer.yahoo.com/oauth/guide/oau...questtoken.html )? This would help isolate the issue by demonstrating that your lib/env can make a 2-leg req to a Y! endpoint.

  • Hi Chris,

    It looks like the problem has an easy fix: replace the "*" char in "select * from ..." w/ "%2A".

    In other words, you need to percent-encode the star. Your oauth lib is doing this for you when generating the base string for the signature, but the query in your request has the unencoded char, so the signature we generate from your request doesn't match the one you send over.

    I just ran this successfully using the oauth gem (v 4.0):

    # replace w/ your key/secret from https://developer.apps.yahoo.com/projects
    consumer_key = "k9TDNTVXpvRnpsbjJHJmQ9WVdrOVpXRlBkWEJETQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD0wYw--"
    consumer_secret = "4fe7cfc3d744d5dad769d21dd9c804"

    @consumer = OAuth::Consumer.new(consumer_key, consumer_secret, :site => "http://query.yahooapis.com")

    access_token = OAuth::AccessToken.new @consumer

    # note the %2A in query
    print access_token.get("/v1/yql?q=select%20%2A%20from%20social.updates.search%20where%20query%3D%22search%20terms%22&diagnostics=false").body

    Please post back if you have any questions
  • QUOTE (Erik @ Apr 29 2010, 03:41 PM) <{POST_SNAPBACK}>
    It looks like the problem has an easy fix: replace the "*" char in "select * from ..." w/ "%2A".

    Oh geez, I should have noticed that un-encoded * in there. Works great now, thanks a lot for the help.

This forum is locked.

Recent Posts

in Updates Firehose