2012-08-12 66 views
3

我正在嘗試將OpenID登錄與Google集成到我的Rails網站。我正在關注Devise & Omniauth概述。出於某種原因,我得到的錯誤,無法找到Devise :: OmniauthCallbacksController的操作'google'

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' 

這是所有做按wiki頁面。當我點擊該網址時,它會將我帶到谷歌,並在輸入憑據後,我被重定向回去。這是發生故障的地方。

我不知道爲什麼會發生這種情況。任何幫助,將不勝感激。

+1

你有沒有添加類似'config.omniauth:google'到devise.rb初始值設定項? – 2012-08-12 09:37:24

+0

@nash - 是的。我忘了提到這一點。我編輯了這篇文章。請看一下。 – 2012-08-12 17:12:34

+0

@Appu你有沒有解決這個問題? – 2012-09-25 21:05:23

回答

1

我使用的是Omniauth(沒有設計),Google的正確操作是:google_oauth2

相關問題