Multiple Sessions for Multiple Users

edited August 2017 in Developers
Hope all are fine and doing well.

I'm building my own website and mobile app as a custom front-end for my users.

I'm using the token based authentication. I understood that items should be added to sessions in order to book them. But how can I manage different sessions for different users trying to book an item from my website or mobile at the same time. Even when I try to start a new session by not providing the session ID the items are added to one session only.

Can someone explain what is the needed workflow for the case here?

Regards

Comments

  • Wasn't my question clear? Seems like almost all other Discussions opened after this was answered almost the same day :smiley:

    I'm still waiting for someone from the Checkfront development team to just write a one line answer if that is possible :smile:.

    So I will put it like this.

    User A & B wanted to book an item from my website that use a back-end integrated with Checkfront using token based authentication.

    User A requested a rated item and got a slip.

    User B requested a rated item and got a slip too.

    User B added the slip to the session but didn't created the booking yet.

    User A added the slip to the session too.

    The current result that I get right now is. When User B try to request the session details. Her/She get a session with his/her item and User A's item as well.

    When user A ask for the session ID he get the same session ID of Users B.

    This means that user A & B actually sharing the session. So the session is on an application level not a user lever.

    Is this what checkfront booking session means? or there is something I just missed?

    Thank you

    Regards
  • Thanks,,,

    I will wait for sure. I thought there was something wrong about my post. Thanks again.

    Regards
  • Hi Makel,

    Thanks for your patience!

    You should be able to create separate booking sessions for each user. I was just able to successfully test this in the Manage > Developers > Console page of a test account. Here are the steps I took:

    Session 1
    1. Send a GET request for a rated item - /item?item_id=34&start_date=today
    2. Copy the returned SLIP ID and send a POST request to /booking/session?id=test1&slip=34.20170829X1-qty.1
    3. The returned session_id was 1bjg5vs5h0eu0plutt99s340o5

    Session 2
    1. Send a GET request for a rated item - /item?item_id=34&start_date=tomorrow
    2. Copy the returned SLIP ID and send a POST request to /booking/session?id=test2&slip=34.20170830X1-qty.1
    3. The returned session_id was vabkf6dq305o3pejlnvfvju0k5

    Now if I send a GET request to /booking/session/?session_id=1bjg5vs5h0eu0plutt99s340o5 I get only the initial item with an ID of 34 for today's date. If I send another GET request to /booking/session/?session_id=vabkf6dq305o3pejlnvfvju0k5 then I get a separate session that only contains the item with an ID of 34 for tomorrow's date.

    Best of luck,
    Mitch
    Checkfront Developer
  • Hey Mitch,

    Thanks for the response. I tried this on postman and it always return the same session id.

    I send a get request with a date 08/30/2017 for usera
    I got a slip
    I send it to the session session_id=usera
    I got a session with an id x

    I send a get request with a date 08/30/2017 for userb
    I got a slip
    I send it to the session session_id=userb
    I got a session with the same id

    you can check what I did from here

    https://www.screenmailer.com/v/sa9w2uXhEwaI8lk 

    Regards
  • Hi Makel,

    Thank you for your reply, and apologies for the delayed response!

    I was able to experience the same issue that you were while using Postman, however when using the built in developer console found under Manage > Developer > Console, posting a slip without a session_id will initiate a new session, which is the intended behaviour. I am not sure why it is not behaving correctly in Postman, but it should work just fine in both your application and in the developer console built into Checkfront. 

    I hope this helps clear up any confusion, but feel free to let me know if you have any additional questions, either by replying here or emailing code@checkfront.com

    Best Regards,
    Brett
    Checkfront Support Team
  • Thanks Brett,,

    I confirm this. Via postman seems like it only return the same id but via the server calles and my code it always create a new one when I don't post one. Seems like its working just fine.

    Thanks
Sign In or Register to comment.