Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 788
Navaneeth K N Avatar asked Feb 27 '26 21:02

Navaneeth K N


1 Answers

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

like image 91
bioneuralnet Avatar answered Mar 02 '26 14:03

bioneuralnet