我正在尝试将 OpenID 登录与 Google 集成到我的 Rails 网站。我正在关注Devise & Omniauth概述。出于某种原因,我收到了错误,
Unknown action
The action 'google' could not be found for Devise::OmniauthCallbacksController
我的routes.rb
有
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
users/omniauth_callbacks_controller.rb
有,
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
skip_before_filter :verify_authenticity_token, :only => [:google]
def google
.....
end
end
我的 user.rb 有,
class User < ActiveRecord::Base
devise :omniauthable, :database_authenticatable, :registerable, :recoverable,
:rememberable, :trackable, :validatable
def self.find_for_open_id(access_token, signed_in_resource=nil)
....
end
end
初始化程序/devise.rb
config.omniauth :open_id, :store => OpenID::Store::Filesystem.new('./tmp'), :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'
这一切都是按照维基页面完成的。当我单击 URL 时,它会将我带到谷歌,输入凭据后,我会被重定向回来。这就是失败发生的地方。
我不确定为什么会这样。任何帮助,将不胜感激。