The credential API came first. Authenticators are a generalization that 
supports more auth systems.

—Jens

On Mar 16, 2016, at 2:04 AM, Brendan Duddridge 
<[email protected]<mailto:[email protected]>> wrote:


I'm just curious what's the difference between using credentials or an 
authenticator on a CBLReplicator object?


The documentation seems to imply they are similar, although the wording is 
slightly different.


For credential:


/** The credential (generally username+password) to use to authenticate to the 
remote database.

    This can either come from the URL itself (if it's of the form 
"http://user:[email protected]";)

    or be stored in the NSURLCredentialStorage, which is a wrapper around the 
Keychain. */


NSURLCredential *credential = [NSURLCredential credentialWithUser:username 
password:password persistence:NSURLCredentialPersistenceSynchronizable];

self.currentPull.credential = credential;


and for authenticator:


/** An object that knows how to authenticate with a remote server.

    CBLAuthenticator is an opaque protocol; instances can be created by calling 
the factory methods

    of the class of the same name. */


id<CBLAuthenticator> authenticator = [CBLAuthenticator 
basicAuthenticatorWithName: username password: password];

self.currentPull.authenticator = authenticator;

Is it better to have both setup like above, or just credential, or just 
authenticator?

To me they both appear to kind of do the same thing, namely provide a username 
and password to the CBLReplicator so it can authenticate against the remote 
server.

Just curious. Currently I have them both set and it seems to do no harm.


Thanks,

Brendan

--
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 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/0c8a2caf-27af-483c-83cc-86a2c78c63b3%40googlegroups.com<https://groups.google.com/d/msgid/mobile-couchbase/0c8a2caf-27af-483c-83cc-86a2c78c63b3%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/2D7AF069-F2F1-4CBD-B725-F901ED7DB946%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to