Search code examples
ruby-on-railsherokuomniauth

Missing client_id parameter.on heroku rails 6


I am trying to authenticate user to rails 6 app using omniauth. It works locally but when I deployed to heroku I was getting an error saying invalid id.

I looked around and found a post about updating the gem from just omniauth-facebook to gem 'omniauth-facebook', '1.4.0', so I did that and now it just goes back to the home page without logging in locally and on heroku I get this error:

{
   "error": {
      "message": "Missing client_id parameter.",
      "type": "OAuthException",
      "code": 101,
      "fbtrace_id": "AYAEC-EyMzZgNXYS2L9klkw"
   }
}

I set my credentials in the credentials.yml file:

facebook:
  facebook_client_id: 1234123412341234
  facebook_client_secret: 12345123451234512345

My devise.rb file is:

config.omniauth :facebook, Rails.application.credentials.dig(:facebook, :facebook_client_id),
  Rails.application.credentials.dig(:facebook, :facebook_client_secret), scope: 'public_profile,email', info_fields: 'email, first_name, last_name, picture'

If you need to see any other code let me know and I will edit the question.


Solution

  • I think your credentials.yml is in .gitignore file, try adding the credentials in heroku config vars.