Paolo
Paolo

Reputation: 390

How to handle Delicious API authorize redirect not handling existing URL GET parameters properly?

I am implementing the /auth/authorize portion of the oAuth instructions here => https://github.com/SciDevs/delicious-api/blob/master/api/oauth.md#authauthorize.

I would like to start out by saying there's no problem with authentication if the redirect uri I use for authentication is a regular uri like this => http://www.example.com. The API will send me back the code I need in this format => http://www.example.com?code=blablabla .

But if the redirect uri has GET parameters attached like this => http://www.example.com?var1=abc&var2=def, the API will send me back the code I need in this format => http://www.example.com?var1=abc&var2=def?code=blablabla which is of course wrong.

Has anyone encountered this issue? If yes, has anyone solved this?

Upvotes: 0

Views: 173

Answers (1)

Paolo
Paolo

Reputation: 390

This is more of a hack that a real solution but it works.

Since I do get the code back (or more importantly its value), I just parse it from the URL. For example, using the example I used above, here are the $_GET variables I would have:

$_GET['var1'] = 'abc' and $_GET['var2'] = 'def?code=blablabla'

What I'd do is:

list($var2, $code) = explode("?code=", $_GET['var2']);

... and I'll still get the code I need to acquire an access token.

Upvotes: 0

Related Questions