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

I am assuming that your users will be able to login and logout, edit profile, register with facebook or register with email and also you may add Confirmable to devise if you want. You should have extra columns in users table. Something like adding extra fields into your user model first.

rails g migration AddFieledsToUser provider:string uid:string image:string

then run rails db:migrate

Check your users table ensure you have these 3 columns above

Also I am assuming that you you have correctly configured initializers/devise.rb like so: config.omniauth :facebook, 'APP_ID', 'APP_SECRET_KEY', scope: 'email', info_fields: 'email, name' after you've properly created the facebook app. Also assuming you have properly created and configured your omniauth_callbacks_controller.rb based on the gems gem 'omniauth', '~> 1.6' and gem 'omniauth-facebook', '~> 4.0' in your gem file successfully. Just make sure you have all these steps done.

In your routes.rb you can add this:

devise_for :users,
         path: '',
         path_names: {
           sign_in: 'login',
           sign_out: 'logout',
           edit: 'profile',
           sign_up: 'registration'
         },
         controllers: {
           omniauth_callbacks: 'omniauth_callbacks',
         }

I think this is the part you have missed. You can also name the routes whatever you want. Just saying.


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?