Devise :: OmniauthCallbacksController无法找到“google”操作

时间:2012-08-12 08:21:44

标签: ruby-on-rails ruby ruby-on-rails-3 devise openid

我正在尝试将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'

这是根据维基页面完成的。当我点击网址时,它会带我去谷歌,输入凭据后,我被重定向回来。这是失败的发生地。

我不确定为什么会这样。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

我使用Omniauth(没有设计),Google的正确操作是:google_oauth2