Limit the session number of single user with POST /{db}/_session api by sync gateway rest api?

Hi,all
I can get HTTP/1.1 200 OK response with Set-Cookie: SyncGatewaySession=***** and authentication_handlers info.
and when I call this api again, I can get another SyncGatewaySession info.
so my question is how can I limit the session‘s number per user? such as one user can only get one session? does sync gateway has some session management method?

Hello @atom_yang,

This sounds a bit like the find or create approach for creating sessions.
Sync Gateway currently doesn’t support this.

Here are the endpoints available for managing user sessions http://developer.couchbase.com/mobile/develop/references/sync-gateway/admin-rest-api/session/index.html

Could you provide a bit more information on your use case?

Thanks
James

I want to use custom auth of sync gateway by sync gateway REST api (not sync gateway admin REST api).
I want my app can works fine even offline. so if user logout offline, sync gateway don’t know that user has logout. so when user login online, the sync gateway will return another session of this user. the old session will still in memory of sync gateway until expire time reached.

Thanks for the explanation. Yes, I would do it like you described.
Sync Gateway doesn’t reuse cookie session.
Likewise, the only way to create a new session is to create a new cookie session.

James