如何让Rails的告诉用户或没有签署移动应用程序? [英] How to let Rails tell mobile applications that users signed in or not?

查看:147
本文介绍了如何让Rails的告诉用户或没有签署移动应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发使用设计作为身份验证解决方案的Rails应用程序。对于Web应用程序,用户在表单中输入用户名和密码,Rails可以呈现不同的网页用户签字后。

I'm developing a Rails application that use devise as the authentication solution. For web applications, users enter username and password in a form, Rails can render different pages after users signed in.

现在我想用这个框架来支持移动应用程序。在这种情况下,移动应用程序需要知道用户是否进入正确的用户名和密码。

Now I'd like to use this framework to support mobile app. In this case, the mobile app needs to know whether the user enters correct username and password.

如何应制定针对体内的移动应用程序,响应头或JSON?是否制定支持呢?

How should devise response to the mobile application, response headers or JSON inside body? Does devise support it?

推荐答案

您需要令牌认证。移动客户端应该有一个登录表单,并访问REST API进行身份验证。如果验证成功,你会得到你需要与在同一会话的所有后续请求发出的令牌。

You need token authentication. Mobile client should have a login form and access the REST API for authentication. If authentication was successful, you will get a token which you need to send with all the subsequent requests in the same session.

http://zyphdesignco.com/blog/simple-auth-令牌例如与 - 设计

http://matteomelani.word$p$pss.com/2011/10/17/authentication-for-mobile-devices/

这篇关于如何让Rails的告诉用户或没有签署移动应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆