Login   Register  
PHP Classes
elePHPant
Icontem

Oauth 2 parameters not processed

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP OAuth API  >  All threads  >  Oauth 2 parameters not processed  >  (Un) Subscribe thread alerts  
Subject:Oauth 2 parameters not processed
Summary:GET and possibly files are ignored
Messages:6
Author:Ben Ariss
Date:2014-01-13 10:25:30
Update:2014-01-27 10:25:25
 

  1. Oauth 2 parameters not processed   Reply  
Picture of Ben Ariss
Ben Ariss
2014-01-13 10:25:30
Hi Manuel,

First off thanks for this package, it's certainly taken the pain away from implementing an OAuth interface!

I'm having some problems interfacing with the Box.net API using your classes however. I'm trying to call the search function which is a GET call and I'm passing the parameter array in, but the SendAPI function doesn't appear to be processing the parameters correctly into the URL.

It looks like all of the code that processes the parameters into the URL for GET calls (and possibly for file uploads as well) are inside an if{} block (line 1191 - 1310) which only runs if the $oath variable is populated from the CallPI function but this is only the case for OAuth v1 and not v2.

Am I doing something wrong or is this a bug in the code?

Thanks!

  2. Re: Oauth 2 parameters not processed   Reply  
Picture of Manuel Lemos
Manuel Lemos
2014-01-13 11:08:21 - In reply to message 1 from Ben Ariss
Can you show the code you are using to call the CallAPI function so I can try to reproduce the problem?

  3. Re: Oauth 2 parameters not processed   Reply  
Picture of Ben Ariss
Ben Ariss
2014-01-13 11:33:47 - In reply to message 2 from Manuel Lemos
Hi Manual,

Here's the CallAPI call that I'm using (I've cut out all the set up code for clarity, let me know if you need this), the API doc for the search call is here http://developers.box.com/docs/#search.

$success = $client->CallAPI('https://api.box.com/2.0/search', 'GET', array('query'=>'BPM'), array('FailOnAccessError'=>true), $search);

The authorisation works fine, it's just this API call that's failing so far. The call fails with a 400 bad request error due to missing parameters. If I manually add the parameters into the url passed into the CallAPI function it works fine.

  4. Re: Oauth 2 parameters not processed   Reply  
Picture of Manuel Lemos
Manuel Lemos
2014-01-18 19:38:53 - In reply to message 3 from Ben Ariss
I see. Well for OAuth 2 the parameters just need to go in the URL, so you can append them to the URL yourself.

The reason why the class only looks at the parameters for OAuth 1 is because OAuth 1 requires the parameters to be signed by computing an additional signature parameter. That is not needed in OAuth 2.

I can make the class look at the parameters for OAuth 2 too and append them to the request URL in a future version, but for now you can do that yourself.

  5. Re: Oauth 2 parameters not processed   Reply  
Picture of Manuel Lemos
Manuel Lemos
2014-01-26 10:44:46 - In reply to message 4 from Manuel Lemos
OK, I just added support to use the parameters values and append them to the request URL for non-POST OAuth 2.0 requests.

  6. Re: Oauth 2 parameters not processed   Reply  
Picture of Ben Ariss
Ben Ariss
2014-01-27 10:25:25 - In reply to message 5 from Manuel Lemos
Lovely, thanks a lot Manuel! :)