简体   繁体   中英

Devise with Google OmniAuth not loading client_id in production

My rails site loads the correct request in development, but in production the client_id is empty in my OAuth request.

access_type=offline
client_id=
redirect_uri=https://example.com/accounts/auth/google_oauth2/callback
response_type=code
scope=email profile
state=...valid state here

My client ID is loaded in config\\initializers\\devise.rb'

 config.omniauth :google_oauth2, 
      Rails.application.credentials.google_omniauth_provider_key,
      Rails.application.credentials.google_omniauth_provider_secret

The value is loaded correctly in in rails c -e production when I load the console and test Rails.application.credentials.google_omniauth_provider_key

My logs don't show any errors or any other hint of what might be wrong. I made sure that my ENV-variable GOOGLE_CLIENT_ID is defined.

I just removed the 12 factor gem and this works now. I would love to know how the 12factor gem and devise might be connected. I was moving my site from heroku to my own server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM