OAuth issue with the Yahoo BOSS API

208 Views Asked by At

I'm trying to call the Yahoo BOSS API with some query strings as detailed here. Things work fine unless there's a space in the query. I'm encoding the query string using URLEncoder.encode(q, "UTF-8").

But as soon as there's a white space in the query string, the request fails with a Please provide valid credentials. OAuth oauth_problem="signature_invalid"error. Since the query string is encoded, the white space should be escaped, has anyone else faced and solved this issue before?

2

There are 2 best solutions below

0
On

I had the exact same problem. You need to use:

UrlEncoder.encode(q,"UTF-8").replace("+","%20")

Your version is breaking your signature because Oauth uses percent encoding to sign the request. So you'll need the %20. A good article on that topic can be found here.

1
On

You need to get the credentials i.e. Customer key and Customer Secret from the authorized person on yahoo's end. Once you get it, you can replace those in the code and will then would be authorized.