Search code examples
ruby-on-rails-3deviseomniauth

devise/omniauth - The action 'facebook' could not be found


I'm trying to implement facebook authentication in my app following this guide

I've followed all the steps but get the following error after hitting login.

Unknown action

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

I've created the file omniauth_callbacks_controller in controllers/users. It has a facebook method defined. Any idea how I should debug?


Adding my routes file -

Myapp::Application.routes.draw do
  get "static_pages/home"

  get "static_pages/help"

  get "static_pages/about"

  devise_for :users do
    resources :posts

  end

  root :to => 'static_pages#home'

  devise_for :users, controllers: {omniauth_callbacks: "omniauth_callbacks"}
end

Solution

  • If you look at the guide it specifies this line for your routes file:

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

    where you have:

    devise_for :users, controllers: {omniauth_callbacks: "omniauth_callbacks"}
    

    see the difference?