On Jul 23, 2014, at 10:35 AM, Seung Chan Lim <djs...@gmail.com> wrote:

> I'm on phone gap / iOS.

Oh right, that makes things a bit different. So you're sending a POST to 
/_replicate. The simplest way is to insert the username (and optionally the 
password) into the remote db URL:
        {"source":"https://myusername:mypassw...@example.net:4984/db";, 
"target":"local-db"}

> I can see how I can send in the WWW-Authenticate header, but what would I 
> need to do do take advantage of the keychain? I guess I'm looking for a 
> plugin for that? (i.e. https://github.com/shazron/KeychainPlugin )

That plugin looks ideal. What you do is add an Internet password entry for the 
base remote URL (https://example.net:4984/db in the example) and realm 
"Couchbase Sync Gateway". Then you don't need to put the password (or username, 
really) in the replication URL anymore.

> How does the replicator _automatically_ to take advantage of the keychain? 
> (i've never used the keychain feature on iOS)

If it gets a 401 status in a response, it asks the Keychain for credentials for 
that URL. If it finds a username/password, it'll retry with those. (Web 
browsers do exactly the same thing.)

--Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/435E1BBB-AB16-45B5-BF0C-0D30DEA69796%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to