设计,OmniAuth &Facebook:“未找到.身份验证通过." [英] 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/initializers/devise.rb 中有 config.omniauth :facebook, ENV['FB_APP_ID'], ENV['FB_APP_SECRET']
, devise_for :users,:控制器 =>{ :omniauth_callbacks =>"users/omniauth_callbacks" }
在我的 routes.rb 中,并定义了一个 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 方法,但这样做只会给我一个 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]
这篇关于设计,OmniAuth &Facebook:“未找到.身份验证通过."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!