-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAuthRequestVerifier::requestIsSigned() failing in API rest call in 1.7.0 #24
Comments
Hmm, very odd indeed as the oAuth implementation specifics haven't changed between the two versions - apart from switching to the PDO data store (which might be the issue I suppose). The userId only refers to the user in the client system - nothing to do with the server. So if you did change the userId you would have to go through the process of AddToServer, etc. Do you happen to have a log of the request that hits the CMS web server? |
Hey Dan I tried to debug the error. The "Request failed with code 500: " is coming from my own Auth Lib on my app side. I originally used a PHP library which I believe was available at: It has the methods to connect to the API. This worked well for 1.6, but I am not sure it is working for 1.7. Perhaps you could verify if it is working for you (if you wrote that initial code)? |
Hey, I can certainly give it a look for you - probably tomorrow now as I have to pop out. The original library uses "php-oauth" as a backend and some very basic test methods I put together that look like this: https://github.com/dasgarner/xibo-example-api. It sounds like something has changed, but I cannot imagine what it might be. I'll check it out. Cheers, |
Thanks Dan - no rush for it. And that's the code! I turned it into a Component Class for CakePHP. I did update the PHP-Oauth to the latest version, so if you find no issues, I will investigate further at my end. Thanks again. |
PS - I actually have a few changes to this code which I could make, so if you wanted to add this on GitHub, I will be happy to fork it and improve on it where I can! |
Sure, im happy for you to fork that (its under my account rather than Cheers!
|
Hi Michael, Well, I found a few issues with the old database class that we are phasing out - it was still around in the API and was causing some problems. That being said I am not sure if that was the cause for your particular issue - as at this end I authenticated and started making API calls without too much trouble. Perhaps you could try the latest and see? |
Hey Dan Thanks for this. I downloaded your latest example code from here: Entered in my server details etc, and dumped the DB. Ran through everything, until I got to this step: Where I got this error: Fatal error: Uncaught exception 'OAuthException2' with message 'Request failed with code 500: ' in /home/michael/public_html/xibo-example-api/oauth-php/library/OAuthRequester.php:117 Stack trace: #0 /home/michael/public_html/xibo-example-api/index.php(546): OAuthRequester->doRequest(1) #1 /home/michael/public_html/xibo-example-api/index.php(153): callService(Array, true) #2 /home/michael/public_html/xibo-example-api/index.php(41): MakeSignedRequest() #3 {main} thrown in /home/michael/public_html/xibo-example-api/oauth-php/library/OAuthRequester.php on line 117 I debugged the line, and it is the SAME error that the CakeAPP is working on. To ensure that the problem was NOT related to anything in the example code, I then used the same code using version 1.6. Amazingly, I got the same result! I debugged further, and got the 500 error, which read: Array ( [code] => 500 [headers] => Array ( [date] => Wed, 21 Jan 2015 14:06:03 GMT [server] => Apache/2.4.7 (Ubuntu) [x-powered-by] => PHP/5.5.9-1ubuntu4.5 [x-xrds-location] => http://360ds2.localhost/xibo/services.php/service.php?xrds [content-length] => 0 [connection] => close [content-type] => text/html ) [body] => ) You will see the "server" is set to: When it should be set as: This seems to be the cause of the issue. When I ran a print_r($this); die;, I could see that the URL was set to: [uri:protected] => http://360ds2.localhost/xibo/services.php It seems to be adding an extra "/services.php" onto the end. I do see in the file: There is a note on line 74: I am not sure if this is related? Could you confirm perhaps if your: Is working locally for you - this will help to debug this one! |
Hi, That did work for me, but only after applying the latest commit to the CMS code (dasgarner/xibo-cms@6a77931) - I think the 500 is because of the legacy database code generating an error. The XRDS is also clearly wrong - i'll create another issue for that. Thanks, |
Thanks Dan. Was the commit above pushed to the xibosignage version - as this is the version I have? |
Ah, no - sorry it wasn't. I'll pull that in now. |
Hey Dan Awesome, that has fixed the issue. After running a REQUEST action, I get the following:
And the API works after that. Just wanted to double check the above wasn't an accidental die or something left on by mistake and is expected. All seems to be solved anyhow! |
I've left debugging output in the example application on, just so it is easier to see what's happening - i'm sure you would edit that out of your Cake version. Don't want all that outputting each time! :) I'll close this issue then - I suspect you might find a few more here and there - really pleased that the move to Github has made this sort of collaboration easier! |
Hey Dan - I totally agree, and thanks for all your help getting these issues sorted so quickly! |
Hey Dan
Found another interesting one. This worked fine in Version 1.6.x, but applyiing the same request in 1.7 is giving a "Not signed." error.
The problem seems to be related to the OAuthRequestVerifier::requestIsSigned() method - which appears to be returning false.
I have successfully connected to the API - the server token is active etc.
In 1.6, I would pass the following to the API:
This would work fine in 1.6
In 1.7, I am passing the following:
You will notice, it is almost the same, however this time, I am getting this not signed error.
Could there be something else missing. I should note, I am following the old API PHP code:
I am not sure if the $user_id = 1; is related - it always worked in 1.6
When I change the $user_id = 2, I get the message:
No server tokens available for http://360ds2.localhost/xibo-cms/services.php
When it is set to $user_id = 1, get:
"Request failed with code 500: "
Unfortunutely, with no related message with it other than a 500.
The text was updated successfully, but these errors were encountered: