Multiple sessions for users and using session on the client

Hey guys,

We are using App server to generate session_id for user. I have question on multiple session for same user.

In the following dataflow when you make 2nd request to CreateSessionB, does CreateSessionA is still valid?

1st Request: User A -> Device A -> App Server -> SyncGateway -> CreateSessionA-> Send it back to Device A

2nd Request: User A -> Device B -> App Server -> SyncGateway -> CreateSessionB-> Send it back to Device B

Also, for using session_id on the client side. I am setting cookies with the session data.
What configuration I need on the SyncGateway? Currently we have GUEST login disabled, and all the documents have owners.

We are using custom authentication and creating SyncGateway users from the App Server using REST API.

Thanks a lot.

Cheers,
DGriffin

1 Answer

« Back to question.

There can be multiple sessions for a user, so the scenario you described is fine. Each device will get its own session cookie.

I don't understand your second question about configuration; can you explain?

--Jens

Thank you for response Jens.

How to configure SyncGateway(Gusest login is disabled) to use the session_id?

Follow up question as same user can have multiple sessions.
We are thinking about creating one SG user, all the documents will be own by one user. App User specific documents will be filtered by channels.
Any feedback/best practice on:-
One SG user for all App user
Vs
Separate SG User for each App User

Thank you.

Why would you do that? You'd lose all access control — anyone will be able to read or write any document.

We are trying not to create SG users on the fly. We may not use it, it was just a thought.

Thank you.