Search code examples
ruby-on-rails-4deviseomniauthomniauth-facebook

The parameter app_id is required for {{url}}/api/v1/auth/facebook


I am trying to access the {{url}}/api/v1/auth/facebook in postman, but I am getting the following error:

"The parameter app_id is required"

Inside devise.rb I've the following config settings config.omniauth :facebook, Rails.application.secrets.facebook_key, Rails.application.secrets.facebook_secret

Inside config/initializers/omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, Rails.application.secrets.facebook_key, Rails.application.secrets.facebook_secret, scope: 'email,age,gender'
end

and my rake routes are as follows:

            GET    /api/v1/auth/:provider/callback(.:format)                  devise_token_auth/omniauth_callbacks#omniauth_success
            GET    /omniauth/:provider/callback(.:format)                     devise_token_auth/omniauth_callbacks#redirect_callbacks
omniauth_failure    GET    /omniauth/failure(.:format)                                devise_token_auth/omniauth_callbacks#omniauth_failure
            GET    /api/v1/auth/:provider(.:format)                           redirect(301)

I am using the following gems

gem 'devise_token_auth'
gem 'omniauth'
gem 'omniauth-facebook'

In the user model, is the following piece of code:

devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable, 
          :lockable, :timeoutable, :omniauthable, :omniauth_providers => [:facebook]

As per the documentation here, I am not supposed to send any parameters explicity. I've already defined the app_id in my ENV variables, but I am still getting this error. I've also tried replacing the params Rails.application.secrets.facebook_key with their actual value, but still ending up in the same error.


Solution

  • Have you tried turning it off and turning it back on again? Your rails app that is.