Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

User Authentication using CouchDB Android

I am developing an app which uses couchDB. When the user opens the app, it will prompt him to enter username and password.

Now my problem is how will I check user authentication in couchDB, I mean how to check if the user is existing user or new user from couch server.

Is there is any secure way for user authentication in CouchDB?

like image 954
user256609 Avatar asked Sep 21 '26 17:09

user256609


1 Answers

I have to disagree with DHK's answer: the CouchDB _users database is a fine way to do user authentication. You're not managing users in code (which is indeed a bad practice); CouchDB handles all the password salting/hashing/etc. automatically for you. The only thing you need to add is SSL (HTTPS) so that the password isn't sent in the clear. This is a feature, not a bug, since that's what HTTPS was designed for.

I wrote a blog post about CouchDB which talks a lot about authentication, and if you just want to quickly get up and running, this rough draft of a PouchDB plugin shows you how to do simple signup/login/logout operations with CouchDB (look at the code; it's super easy).

The only difference between how that plugin works and how you'll do it on Android is that you can't use cookies. You'll use basic HTTP authentication (https://user:[email protected]:5984), which again is fine as long as you're using SSL. CouchDB has docs on SSL, or you can just put an Nginx proxy in front of it (my preferred solution).

like image 104
nlawson Avatar answered Sep 24 '26 05:09

nlawson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!