Homepage | Products | OX Knowledge Base | Support | Try Now | Contact | Company
OX Logo
Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    elocallink Guest

    Default Using the API, max sessions reached

    Hi, I've written a PHP class to connect with the HTTP API, and most things work smoothly. But it seems that logging out from a session does not remove the session. After several login's, checking for new email, logging out, I eventually get this error on attempting to log in:
    Max. session size for user %1$s in context %2$s

    I don't want to increase the number of sessions allowed, I would rather find a way to clear all sessions for a user through the API, or ideally logging out using an ox_session identifier would automatically remove the session, but it seems not to.

    Any ideas?

    Greg

  2. #2
    Join Date
    Feb 2007
    Location
    Germany
    Posts
    3,695

    Default

    Hi,

    clearing all sessions is not possible. It would also affect sessions initiated by other clients (browsers, mobiles...). Your script has to close the session that it opened on every usage. OX loggs login/logout on loglevel INFO so you can use this to debug the script for missing or incorrect logut calls.

    Greetings

  3. #3
    elocallink Guest

    Default

    Thanks. I am logging out, but the curl call returns no error (returns nothing at all) so I assumed that logging out would close the session.

    Greg

  4. #4
    Join Date
    Feb 2007
    Location
    Germany
    Posts
    3,695

    Default

    Hi Greg,

    of course, the logout call terminates the session provided by the logout call. Could you give an example of the logout call you do? Keep in mind to send mandatory parameters like sessiond and cookies.

    Greetings

  5. #5
    elocallink Guest

    Default

    Logging in with:
    PHP Code:
      function login($user,$pass,$cookieFile){
        
    $ch curl_init('http://domain.com/ajax/login?action=login&name='.$user.'&password='.$pass); 
        
    curl_setopt($chCURLOPT_GET1); 
        
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
    curl_setopt($chCURLOPT_COOKIEJAR$cookieFile);
        
    curl_setopt($chCURLOPT_COOKIEFILE$cookieFile);

        
    $results curl_exec($ch); 
        
    $results=json_decode($results);
        
    curl_close($ch);

        
    $ox_session $results->session;
        return 
    $ox_session;
      } 
    Then at the end, log out with:
    PHP Code:
      function logout($session_id,$cookieFile){
        
    $ch curl_init('http://domain.com/ajax/login?action=logout&session="'.$session_id); 
        
    curl_setopt($chCURLOPT_GET1); 
        
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
    curl_setopt($chCURLOPT_COOKIEJAR$cookieFile);
        
    curl_setopt($chCURLOPT_COOKIEFILE$cookieFile);

        
    $logout curl_exec($ch); 

        
    $results=json_decode($logout);
        
    curl_close($ch);
        
      } 
    Greg

  6. #6
    elocallink Guest

    Default

    I keep trying to paste the code how I log out, but it won't show up as a post. I get a message that the moderator needs to approve it.

    I am attaching it as a text file. Hope that works.

    Greg
    Attached Files Attached Files

  7. #7
    elocallink Guest

    Default

    In the log I see this for the login:

    Dec 15, 2010 9:05:04 AM com.openexchange.login.internal.LoginPerformer logLoginRequest
    INFO: Login:gregt AuthID:8e2a7a62f1344022a7e6de669a7f7816 Agent:null Client:null(null) Interface:HTTP_JSON Context:1(1,CGI-OX,defaultcontext) User:11(gregt) Session:2e63b8af1b1144eab1579e94590c9c86

    but no corresponding entry for the logout. You can see the api call I am making in the txt file above.

    Greg

  8. #8
    Join Date
    Feb 2007
    Location
    Germany
    Posts
    3,695

    Default

    Yes, the API calls seem to be okay, but perhaps the script does not call the logout function properly in any case?

  9. #9
    Join Date
    Feb 2007
    Posts
    251

    Default

    What's that double quote doing there?
    Code:
    function logout($session_id,$cookieFile){
    	$ch = curl_init('http://domain.com/ajax/login?action=logout&session="'.$session_id);

  10. #10
    elocallink Guest

    Default

    Wtf? What indeed is that double quote doing there ruining my development schedule!!

    Viktor, I owe you and your sharp eyes a beer! Thank you!

    Greg

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •