cloudant / CDTDatastore

Cloudant Sync iOS datastore library.
Apache License 2.0
175 stars 53 forks source link

How to use Basic Authentication? #393

Closed azri92 closed 6 years ago

azri92 commented 7 years ago

In the Changelog, I can see that:

Replications will use session cookies to authenticate rather than using Basic Auth for every request.

So, how do we use Basic Authentication instead? This is possible in sync-android. But I can't find any mention of this in CDTDatastore's docs.

ricellis commented 7 years ago

You'll need to implement a CDTHTTPInterceptor -interceptRequestInContext that adds the Authorization header to the request and add that interceptor to your replication. See https://github.com/cloudant/CDTDatastore/blob/master/doc/httpinterceptors.md for more information about interceptors.

Out of curiosity what is the use-case that means the session cookie doesn't work for you?

azri92 commented 7 years ago

Thanks for the reply.

The CouchDB server I'm connecting to doesn't have cookie auth up yet, so I just had to fallback to basic auth.