couchbaselabs / TodoLite-PhoneGap

Basic todo list app for Couchbase Lite and PhoneGap
55 stars 27 forks source link

persona and custom authentication #9

Open deefactorial opened 10 years ago

deefactorial commented 10 years ago

Any plans to implement persona or custom authentication in the TodoLite example app ? Persona does not have lists of friends to share things with but tasks could be shared by email for persona.

for custom authentication could I just login to my server using coax like this:

    var url = REMOTE_LOGIN_URL;
    coax.get(url, function(err, data) {
        if (err) {return cb(err)}
        log("Server Login Data:", data)
        cb(false, data)
    }) 

which would set the session cookie for the domain. Would successive requests to the sync_gateway succeed because the cookie is set?

tleyden commented 10 years ago

Any plans to implement persona or custom authentication in the TodoLite example app ?

Yep, this was omitted due to time constraints, not because we don't want it. Contributions welcome!

Would successive requests to the sync_gateway succeed because the cookie is set?

With iOS, that might work, as long as the sync gateway is running on the same host as the sync gateway (or uses a proxy trick). With Android, that won't work, and you'll need to explicitly set the cookie via Replication.setCookie, which is unfortunately currently not exposed via the REST API for a phonegap app to call (but it could be)

/cc @jchris -- any thoughts on this?

deefactorial commented 10 years ago

I found that if basic authentication credentials are used for the REMOTE_SYNC_URL I was able to sync the databases, for server authentication the user could log into the servers custom authentication then use basic authentication for each successive REST request. I'm re-writing the TodoLite-Phonegap app to enable server authentication using basic authentication.

Does anyone know how to set the basic authentication header of a coax request ?