Navaneeth K N
Navaneeth K N

Reputation: 15521

The action 'google' could not be found for Devise::OmniauthCallbacksController

I am trying to integrate OpenID login with Google to my Rails website. I am following the Devise & Omniauth overview. For some reason, I am getting the error,

Unknown action

The action 'google' could not be found for Devise::OmniauthCallbacksController

My routes.rb has,

devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }

users/omniauth_callbacks_controller.rb has,

class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
  skip_before_filter :verify_authenticity_token, :only => [:google]

  def google
     .....
  end       
end

My user.rb has got,

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

initializers/devise.rb

config.omniauth :open_id, :store => OpenID::Store::Filesystem.new('./tmp'), :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'

This is all done as per the wiki page. When I click the URL, it takes me to google and after entering credentials, I am redirected back. This is where the failure happening.

I am not sure why this is happening. Any help would be appreciated.

Upvotes: 3

Views: 567

Answers (1)

bioneuralnet
bioneuralnet

Reputation: 5301

I use Omniauth (without Devise) and the correct action for Google is :google_oauth2.

Upvotes: 1

Related Questions