我使用「omniauth - 谷歌 - 的oauth2」爲在與谷歌,並按照這裏的所有指令仔細行動「google_oauth2」無法找到用戶:: OmniauthCallbacksController
https://github.com/plataformatec/devise/wiki/OmniAuth%3A-Overview
,但我有錯誤以上。
我的路線
devise_for :users, :controllers => {
:omniauth_callbacks => "users/omniauth_callbacks"
}
devise.rb代碼
config.omniauth :google_oauth2, "863625299460- 420n6c7lvad91dfvko60uamtvtr6huhf.apps.googleusercontent.com", "dcvA2aZRZi27KCQjWTYP30pw", { access_type: "offline", approval_prompt: "" }
omniauth回調控制器代碼
def google_oauth2
#@user = User.find_for_google_oauth2(request.env["omniauth.auth"], current_user)
binding.pry #control not coming here
end
下面我有回調之後錯誤。見屏幕截圖
https://github.com/zquestz/omniauth-google-oauth2/issues/52
我有mtach的路線,但它也沒有工作匹配 「/用戶/認證/ google_login /回調」:以=> 「用戶/ omniauth_callbacks#goole_oauth2」 – Kashiftufail
我看到使用路線grep命令user_omniauth_authorize /用戶/ AUTH /:provider(.:format)users/omniauth_callbacks#passthru {:provider =>/google_oauth2 /} user_omniauth_callback /users/auth/ :action/callback(.:format)users/omniauth_callbacks#(? - mix:google_oauth2) user_omniauth_authorize /users/auth/:provider(.:format)devise/omniauth_callbacks#passthru {:provider =>/google_oauth2 /} user_omniauth_callback /users/auth/:action/callback(.:format)devise/omniauth_callbacks#(? - 混合:google_oauth2) – Kashiftufail
我的錯誤是我不要添加這一行。設計:omniauthable,:omniauth_providers => [:google_oauth2] – Kashiftufail