简体   繁体   中英

Error with Oauth token not redirect

Basically, I can't find my production ID and my production API secret. I can only find the developer ones. Am I supposed to submit for review first? My OAuth is all set up.

I also have my YML So do I submit first and I will get this second ID? This has been my problem all day long. Thanks.

It looks like this:

Development:
facebook_api_key:
facebook_api_secret:

Production: 
facebook_api_key:
facebook_api_secret:

I tried adding my ID and secret for both of them even though it was only on dev! Please help me!

Actually, your problem has nothing to do with oauth. It is about how to setup secret variables between different environments.

I use figaro gem to handle this kind of variables:

First, add figaro in your Gemfile.

Gemfile

gem 'figaro'

Setup variables in config/applicaiton.yml. (I usually use UPPER CASE for these variables)

config/application.yml

development:
  FB_KEY: your_fb_key_for_development
  FB_SECRET: your_fb_secret_for_development

production: 
  FB_KEY: your_fb_key_for_production
  FB_SECRET: your_fb_secret_for_production

And use ENV to get variables where you want,

config/initializers/devise.rb

Devise.setup do |config|
  # ...
  # Onmi configurations
  require "omniauth-facebook"
  config.omniauth :facebook, ENV['FB_KEY'], ENV['FB_SECRET']
  # ...
end

If you want to do it without any gem, please see: stackoverflow - Setting Environment Variables in Rails 3 (Devise + Omniauth)

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