I have a rails website in which I am using devise
and OmniAuth
for authentication (email + social authentication). Now I want to implement an api that will serve as a backend for my android app. I was wondering how can I extend my existing authentication system so that I can provide the same authentication functionality of email and social login to my android users? Also, a person should be able to login using same credentials on web and android app.
答案 0 :(得分:0)
您需要在用户表中添加api令牌字段。
每次当android用户请求登录时,在成功匹配电子邮件和paasword之后,API令牌将创建具有到期时间。然后每次必须使用android请求发送API令牌。
如果API令牌有效,请求将完成。
要区分您的请求,您可以在路线中使用命名空间,例如/ api / v1 / login