> On Nov 18, 2014, at 7:42 PM, Seung Chan Lim <
djs...@gmail.com> wrote:
>
> Hmmm... Good catch. It's not. I assumed that it was, but I was wrong. Then am I misunderstanding something about calling _replicate?
No; but I just remembered a detail about Cocoa's NSURLConnection class — IIRC, "Cookie:" headers that the client adds to the request will be overwritten by cookies looked up from the NSHTTPCookieStorage.
In the native API the CBLReplication class has a method to set a cookie, but in REST your only option is to specify it as a header the way you're doing, so this looks like a real problem. Hm.
I've just sent a question to Apple's networking mailing list to see if there's a way around that. Otherwise I don't have any good workarounds for you, other than somehow getting your custom auth API to appear to come from the same host/port as the Sync Gateway, so that it can use a Set-Cookie: response header.
—Jens