Omniauth 不是指向 FB 而是我的根? /
在我看来,我有:
<%= link_to "Sign in with Facebook", user_omniauth_authorize_path(:facebook) %>
它使用链接呈现: http://localhost:3000/users/auth/facebook
问题是当我单击该链接时,它会直接加载到:
Started GET "/" for 127.0.0.1 at 2011-09-26 15:35:29 -0700
Processing by PagesController#landing_teaser as HTML
Rendered pages/landing_teaser.html.erb within layouts/unauthorized (7.1ms)
Completed 200 OK in 13ms (Views: 11.2ms | ActiveRecord: 1.0ms)
这是我的路由文件:
match '/users/auth/facebook/callback' => 'authentications#create'
# Devise
devise_for :users, :controllers => {:registrations => "registrations"}
关于omniauth 失败的原因有什么想法吗?
谢谢
in my view I have:
<%= link_to "Sign in with Facebook", user_omniauth_authorize_path(:facebook) %>
Which renders with the link: http://localhost:3000/users/auth/facebook
Problem is when I click that link it loads directly to:
Started GET "/" for 127.0.0.1 at 2011-09-26 15:35:29 -0700
Processing by PagesController#landing_teaser as HTML
Rendered pages/landing_teaser.html.erb within layouts/unauthorized (7.1ms)
Completed 200 OK in 13ms (Views: 11.2ms | ActiveRecord: 1.0ms)
Here is my routes file:
match '/users/auth/facebook/callback' => 'authentications#create'
# Devise
devise_for :users, :controllers => {:registrations => "registrations"}
Any thoughts on why omniauth is failing?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看你的路线,我发现你只定义了
,但在设计omniauth教程路线包含此(对于记录来说,如果您仅使用omniauth,则应该有所不同)
我唯一看到的是
/users/auth/facebook
路径不与您的路线文件不匹配并且它通过一些设计(oomniauth)默认路由。当您清除 cookie 时,您会重置浏览器的“状态”并开始新的会话。当您有一些 cookie(可能是之前的身份验证)时,它会识别您之前的会话,并且不会要求您再次进行身份验证,除非您明确注销。
我开发了一个使用 devise+omniauth+google apps 身份验证的应用程序,它偶尔会要求我提供凭据,即使我关闭浏览器并重新打开它也是如此。
Looking at your routes I see that you only define
but in devise omniauth tutorial the route contains this (and for the records it should be different if you're using only omniauth)
The only thing I see is that
/users/auth/facebook
path doesn't match your route file and it goes through some devise (o omniauth) default route.When you clear your cookies you reset the "status" of your browser and it starts a new session. When you have some cookies (maybe of a previous authentication) it recognize your previous session and don't ask you to authenticate again unless you do an explicit logout.
I've developed an application which uses devise+omniauth+google apps authentication and it ask me for credentials only once in a while, even when I close the browser and reopen it.