The parameter app_id is required on Heroku omiAuth

2020-05-03 13:52发布

问题:

I am getting the error "The parameter app_id is required" when I test my facebook login in my app. I guess it has to do with my configurations. Can you please check my configuration files and let me know if there is an error. I even set the app id and secret on heroku

heroku config:set FACEBOOK_APP_ID=133333333463066  
              FACEBOOK_SECRET=a7244e333333333a7a2bf9492a6089a0

Here is my omniauth initializer file : config/initializer/omniauth.rb

OmniAuth.config.logger = Rails.logger
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, ENV["FACEBOOK_APP_ID"], ENV["FACEBOOK_SECRET"]
end

My devise initializer has the following line:

config.omniauth :facebook, "FACEBOOK_APP_ID" , "FACEBOOK_SECRET"

What am I doing wrong ?

On localhost, I am getting this error instead:

{
 "error": {
  "message": "Missing client_id parameter.",
  "type": "OAuthException",
  "code": 101
 }

}

I get this url when I try to login with facebook

https://graph.facebook.com/oauth/authorize?  client_id=&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fusers%2Fauth%2Ffacebook%2Fcallback&response_type=code&scope=email&state=223cbab26ab10640a2c1fe62508aecb94ffc2854721703de

As you can see, client id is empty in the URL.