Giter VIP home page Giter VIP logo

Comments (14)

dasgarner avatar dasgarner commented on June 12, 2024

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?

from xibo.

MichaelHoughton avatar MichaelHoughton commented on June 12, 2024

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:
https://code.launchpad.net/xibo

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)?

from xibo.

dasgarner avatar dasgarner commented on June 12, 2024

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,
Dan

from xibo.

MichaelHoughton avatar MichaelHoughton commented on June 12, 2024

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.

from xibo.

MichaelHoughton avatar MichaelHoughton commented on June 12, 2024

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!

from xibo.

dasgarner avatar dasgarner commented on June 12, 2024

Sure, im happy for you to fork that (its under my account rather than
xibosignage as its only some example code - but I think you should still be
able to fork.

Cheers!
On 20 Jan 2015 17:23, "Michael Houghton" [email protected] wrote:

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!


Reply to this email directly or view it on GitHub
#24 (comment).

from xibo.

dasgarner avatar dasgarner commented on June 12, 2024

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?

from xibo.

MichaelHoughton avatar MichaelHoughton commented on June 12, 2024

Hey Dan

Thanks for this. I downloaded your latest example code from here:
https://github.com/dasgarner/xibo-example-api

Entered in my server details etc, and dumped the DB.

Ran through everything, until I got to this step:
http://localhost/xibo-example-api/index.php?action=Request

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:
http://360ds2.localhost/xibo/services.php/service.php?xrds

When it should be set as:
http://360ds2.localhost/xibo/services.php?xrds

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:
lib/service/serviceresponse.class.php

There is a note on line 74:
// TODO: Need to strip out the services.php part of serviceLocation - or work out a better way to do it.

I am not sure if this is related?

Could you confirm perhaps if your:
xibo-example-api/index.php?action=Request

Is working locally for you - this will help to debug this one!

from xibo.

dasgarner avatar dasgarner commented on June 12, 2024

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,
Dan

from xibo.

MichaelHoughton avatar MichaelHoughton commented on June 12, 2024

Thanks Dan. Was the commit above pushed to the xibosignage version - as this is the version I have?

from xibo.

dasgarner avatar dasgarner commented on June 12, 2024

Ah, no - sorry it wasn't. I'll pull that in now.

from xibo.

MichaelHoughton avatar MichaelHoughton commented on June 12, 2024

Hey Dan

Awesome, that has fixed the issue.

After running a REQUEST action, I get the following:

OAuthRequester Object ( [files:protected] => [request:protected] => [store:protected] => OAuthStorePDO Object ( [conn:OAuthStorePDO:private] => PDO Object ( ) [lastaffectedrows:OAuthStorePDO:private] => [max_timestamp_skew:protected] => 600 [max_request_token_ttl:protected] => 3600 ) [usr_id:protected] => 0 [signed:OAuthRequestSigner:private] => [realm:protected] => [param:protected] => Array ( [service] => rest [method] => Version [response] => json ) [uri_parts:protected] => Array ( [scheme] => http [host] => 360ds2.localhost [path] => /xibo-cms/services.php [port] => 80 [user] => [pass] => [query] => [fragment] => ) [uri:protected] => http://360ds2.localhost/xibo-cms/services.php [headers:protected] => Array ( [Accept] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 [Accept-Encoding] => gzip, deflate [Accept-Language] => en-US,en;q=0.5 [Connection] => keep-alive [Cookie] => __utma=111872281.559460213.1407426960.1417085927.1420554975.6; __utmz=111872281.1407426960.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __ar_v4=PNBCPPK4TJDO5FAACLQHWH%3A20140806%3A3%7CJGFYKFRETBC6TKXSFBR44G%3A20140806%3A3%7CDY57SKZYKBFQHI6756ADDK%3A20140806%3A3; _ga=GA1.1.559460213.1407426960 [Host] => localhost [Referer] => http://localhost/xibo-example-api/index.php?action=Exchange&consumer_key=ddb54046faf2499e8a2a2f48f1a8c295054bd1332&usr_id=1&oauth_token=3038909404070c2ba88a802a4c18581e054bfdeca&oauth_verifier=807b9eed05 [User-Agent] => Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0 ) [method:protected] => GET [body:protected] => ) 

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!

from xibo.

dasgarner avatar dasgarner commented on June 12, 2024

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!

from xibo.

MichaelHoughton avatar MichaelHoughton commented on June 12, 2024

Hey Dan - I totally agree, and thanks for all your help getting these issues sorted so quickly!

from xibo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.