0

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!

usha
  • 28,973
  • 5
  • 72
  • 93

1 Answers1

0

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)

Community
  • 1
  • 1
Sibevin Wang
  • 4,480
  • 3
  • 27
  • 27