How does one get the session cookie that is set after accessing the _persona url?

6 views
Skip to first unread message

vikas sachdeva

unread,
May 4, 2016, 3:56:50 PM5/4/16
to Couchbase Mobile

Clients log in by sending a POST request to /dbname/_persona. The request body is a JSON document that contains an assertion property whose value is the signed assertion received from the identity provider. Just as with a _session login, the response sets a session cookie.

How does one get the session cookie that is set after accessing the _persona url?

I am trying to understand this so I can allow the user to skip the persona login if their session is still valid.

The result I get back from the urlConnection using _persona is below but I'm not sure if that helps.
{
"authentication_handlers": [
"default",
"cookie",
"persona"
],
"ok": true,
"userCtx": {
"channels": {},
"name": "er...@consultant.com"
}
}

Jens Alfke

unread,
May 4, 2016, 10:01:29 PM5/4/16
to mobile-c...@googlegroups.com

> On May 4, 2016, at 11:42 AM, vikas sachdeva <vikassac...@gmail.com> wrote:
>
> How does one get the session cookie that is set after accessing the _persona url?

There isn’t a way to get that. The request is sent by the replicator, which uses a private cookie store. (At least on iOS. I am not sure how the cookie handling works on other platforms.)

> I am trying to understand this so I can allow the user to skip the persona login if their session is still valid.

Instead of trying to preflight, just let the replicator run. If there is no valid session, the replicator will get a 401 error. In that case, start the Persona login UI, and when you get a new token, register it and try again.

—Jens
Reply all
Reply to author
Forward
0 new messages