如何使用用户名/密码对Devise和Android用户进行身份验证?

时间:2022-08-20 15:28:42

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

我正在研究的项目是使用Devise进行身份验证的Android / Rails混合项目。我已经有令牌认证设置了。

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.

我不想弄清楚如何通过Android设备登录用户。 Android应用程序上有用户名/密码登录表单。我希望它将用户名和密码发送到Rails应用程序,让Rails应用程序根据这些凭据对用户进行身份验证,然后让Rails应用程序使用此用户的令牌进行响应。

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

我怎样才能做到这一点?是否有一个Devise方法,我可以传递用户名和密码进行身份验证?

Thanks.

谢谢。

1 个解决方案

#1


1  

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

您应该了解Devise对HTTP基本身份验证的支持。此博客文章描述了启用它的过程。

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

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

更新:这是一个详细的幻灯片放映,解释了使用设计进行身份验证的各种方法:http://presentations.royvandewater.com/authentication-with-devise.html

#1


1  

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

您应该了解Devise对HTTP基本身份验证的支持。此博客文章描述了启用它的过程。

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

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

更新:这是一个详细的幻灯片放映,解释了使用设计进行身份验证的各种方法:http://presentations.royvandewater.com/authentication-with-devise.html