Authenticating via Session on Sync Gateway in Unity3D


#1

I am using Couchbase Lite 1.1.0
According to this page, I have to set the cookie name, session id and expiry that returned from Create Session call.

In my create session call, I got the follows
Cookie:
Name: ui-auth-xxx.xxx.xxx.xxx%3A8091
Value: aeda6c5b57a9be2afd284daa202f9d62
Domain: xxx.xxx.xxx.xxx
Path: /
Expires: (nothing, it was empty)
Http: true
Secure: (nothing, it was empty)

Response Body:ui-auth-10.197.15.61%3A8091
{
“session_id”: “2a18930da94d26e9d49bb83ab1c6a4541c3f68e2”,
“expires”: “2015-11-06T17:48:36.932951542+09:00”,
“cookie_name”: “SyncGatewaySession”
}

I tried to set the Pull with SetCookie as follows:
pull.SetCookie(“SyncGatewaySession”, “2a18930da94d26e9d49bb83ab1c6a4541c3f68e2”, “//”, DateTime.Parse(“2015-11-06T17:48:36.932951542+09:00”), false, true);

But I got fail on parsing the date time with C#.
I tried to insert a time close to the expiry time, but I still fail on doing the Pulling.
The Sync Gateway just keep on returning:
2015-11-06T17:49:10.027+09:00 HTTP: #300: --> 401 Login required (0.4 ms)

What am I missing here?


#2

Is the “//” in the SetCookie call correct? I think it should just be “/” but actually I’m not as familiar with cookies as I should be. It’s quite possible that the cookie is not getting set correctly.


#3

Oh my god, you’re right, that’s exactly where I was wrong!
Sad… I spent like few hours to try figures out am I inserting the correct time…
Thanks!