SyncGateway - REST User Authentication with Facebook

I am creating a Node JS API that should serve as access point to the SyncGateway server for a web page.
The Couchbase database is already served through a mobile app (, but now I am building the related web-app (
I have the users authenticating through Facebook and I am now stuck in the authentication process.
In particular I am already registering the user with a POST to:


and receiving the response:

{ authentication_handlers: [ ‘default’, ‘cookie’ ],
ok: true,
{ channels: … }

but from this point how should I make the next requests to SyncGateway as the registered user?
I use CouhBase 4 community and SyncGateway 1.2.1.
Thanks for your feedback.

That response should also include a SetCookie header with the Sync Gateway session information - you can use that session for subsequent authentication.

Ok. I found the set-cookies in the header.
I tried to put the same set-cookie in the header of the next request from the user, but it does not seem to work.
Can you give me an example?