Trying to follow along with https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview and I\'m stumped.
I\'ve got config.omniauth :facebook, ENV[\'FB_AP
Try setting omniauth_path_prefix in devise initializer (config/initializers/devise.rb) file.
For User class:
config.omniauth_path_prefix = "/users/auth"
For other class (e.g. when you use Account not User):
config.omniauth_path_prefix = "/accounts/auth"
Same thing with translated routes (my case). I've tranlated 'users' into 'blabla'. To have it working I had to set prefix to "/blabla/auth". (Works for only one locale!)
Also make sure you have added a route to the OmniauthCallbacksController:
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
and that you have added the update to the devise declaration in your User model:
devise :omniauthable, :omniauth_providers => [:facebook]
Make sure to write the same spelling of providers on both user.rb and devise.rb like -
user.rb
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable, :omniauthable, omniauth_providers: [:google_oauth2, :facebook], authentication_keys: [:login], reset_password_keys: [:login], confirmation_keys: [:login]
devise.rb
config.omniauth :google_oauth2, ENV["GOOGLE_OAUTH_CLIENT_ID"], ENV["GOOGLE_CLIENT_SECRET"],
{
scope: 'userinfo.email, userinfo.profile',
prompt: 'select_account',
image_aspect_ratio: 'square',
image_size: 50
}
config.omniauth :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET'], scope: 'email', info_fields: 'email, first_name, last_name', callback_url: "#{ENV["HOST_URL"]}/users/auth/facebook/callback"