简体   繁体   中英

How can I authenticate a user with Devise and Android using username/password?

The project I'm working on is an Android/Rails hybrid using Devise for authentication. I've already got token authentication setup.

What I am not trying to figure out how to do is how to login a user via the Android device. There is a username/password login form on the Android application. I want it to send the username and password to the Rails application, have the Rails application authenticate the user based on these credentials, and then have the Rails application respond with this user's token.

How can I do this? Is there a Devise method that I can pass a username and password to for authentication?

Thanks.

You should look into Devise's support for HTTP Basic Authentication. This blog post describes the process for enabling it.

http://pivotallabs.com/users/ledwards/blog/articles/1534-http-basic-authentication-and-devise

Update: Here is a detailed slide show explaining the various methods of authenticating using devise: http://presentations.royvandewater.com/authentication-with-devise.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM