Devise,OmniAuth& Facebook:“未找到。认证passthru“。 [英] Devise, OmniAuth & Facebook: "Not found. Authentication passthru."
问题描述
试图跟随 https://github.com/plataformatec/devise/wiki/OmniAuth:-概述,我被困了。
Trying to follow along with https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview and I'm stumped.
我有 config.omniauth:facebook,ENV ['FB_APP_ID'],ENV ['FB_APP_SECRET']
在我的config / initializers / devise.rb中, devise_for:users,:controllers => {:omniauth_callbacks =>我的routes.rb中的users / omniauth_callbacks}
,并定义了一个OmniAuthCallbacks控制器。
I've got config.omniauth :facebook, ENV['FB_APP_ID'], ENV['FB_APP_SECRET']
in my config/initializers/devise.rb, devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
in my routes.rb, and an OmniAuthCallbacks controller defined.
当我访问 user_omniauth_authorize_path(:facebook)
时,我得到:
未找到。认证passthru。
我不知道接下来该怎么做。我没有使用路由游戏,所以我不相信我需要定义一个passthru方法,但是这样做只是给了我一个404。
When I visit user_omniauth_authorize_path(:facebook)
, I get:
Not found. Authentication passthru.
I'm not sure what to do next. I am not using route globing, so I don't believe I need to define a passthru method, but doing so just gives me a 404.
推荐答案
还要确保你已经添加了一个路径到OmniauthCallbacksController:
Also make sure you have added a route to the OmniauthCallbacksController:
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
,并且您已将更新添加到用户模型中的设计声明:
and that you have added the update to the devise declaration in your User model:
devise :omniauthable, :omniauth_providers => [:facebook]
这篇关于Devise,OmniAuth& Facebook:“未找到。认证passthru“。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!