Ruby on Rails - 如何在omniauthable设备中处理过时的访问令牌?
当用户的访问令牌过时并从而将用户注销时,如何在设备中检测到?
How do I detect in devise when the user's access tokens are stale and thus logging the user out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么需要这个?有
timeoutable
选项允许跟踪会话超时。我可能是错的,但令牌是有时间存在的 cookie 键,并且由浏览器跟踪。来自设计(钩子):---- 更新(不要放入太大的commets)---
在大多数情况下,当您使用登录时,不需要从外部服务获取身份验证。因此,在用户登录的情况下(即存在会话 cookie 并且会话有效),同时她从外部服务注销,这意味着她可以使用您的网站,直到您的会话结束。过期。同样,一旦用户需要身份验证,就会使用外部服务。因此,当您网站上的会话过期并且用户尝试使用外部服务登录时,她将被重定向到她将登录的外部网站(如果已经登录,则不会)。然后,外部服务重定向回您的站点提供的回调(在大多数情况下,路径是 /auth/:provider/callback),您的控制器(或由
devise
提供的默认值)将在需要时创建一个用户和一个为他举行会议。Why do you need this? There is
timeoutable
option exist that allows to track session timeout. I might be wrong, but tokens are cookies keys that have time to live and they are tracked by browser. From Devise (hooks):---- UPDATE (to not put in commets as its large)---
In the most cases, when you use is logged in, there is no requirements to get authentication from external servises. So in the cases when user is logged in (i.e. session cookie present and session is valid), and in the same time she logs out from external servise that means that she can use your site until your session is expires. Again, the external service is used once user requires authentication. So when session is expired on your site and user trying to log in using external service she will be redirected to external site where she will log in (or not if already). Then external service redirects back to your site provided callback (in the most cases path is /auth/:provider/callback) where your controller (or default provided by
devise
) will create if required an user and a session for him.