Trouble logging out with .php?

PatBCPatBC Member Posts: 1
I have a question :

When I use the API to access and edit a product, I’m able to log out easily with this simple .php code :

        $rest->createRequest($urllogout, "POST", NULL, $_SESSION['cookies'][0]);

When it comes to only grabbing infos through “GET”, the API never logs off. I use the exact same code, but this time, when I read the REST_CONNECTOR OBJECT it says something like :
RESTConnector Object
    [root_url:RESTConnector:private] => 
    [curr_url:RESTConnector:private] =>
    [exception:RESTConnector:private] => 
    [responseBody:RESTConnector:private] => Unexpected HTTP Status: 403 Forbidden server.forbidden
    [cookieJar:RESTConnector:private] => HTTP_Request2_CookieJar Object
So yeah, a 403 error which couldn’t be related to the fact that there is multiple licenses (I am only using one, it’s 3 AM and no one else is working), so according to your tutorials, it shouldn’t be related to the user-seats, so does it mean that my URL is malformed? Do you have any idea why it does that? :( 

Forbidden. The server understood the request, but is refusing to fulfill
it. May occur if there are no more user-seats available to connect to the
LightSpeed Server (see the note in Authentication); if you
attempt a POST/PUT/UNLOCK/LOCK call using a read-only application; or the
url is malformed.

It’s annoying because it always clog up the user seats even if we use only one banal request… After something like 5 requests, we need to restart the server again.

Thanks for helping out!

1 comment

  • jamesratcliffejamesratcliffe Administrator, Lightspeed Staff Posts: 160 moderator
    @PatBC The logout endpoint didn't work for read-only API apps before OnSite version 2016 1.0.5. I'm guessing this is your issue.

    If so, you can't close sessions with your read-only app, so they'll stay open until someone restarts the OnSite server. Read-only apps don't count towards the session limit, so it won't affect users.

    If you can upgrade the server to a more recent version, you'll be able to make the logout call.
    James Ratcliffe
    Lightspeed HQ
Sign In or Register to comment.