Reputation: 4896
I need to test the omniauth-facebook authentication from my local application. However, the Facebook Developer website is asking for the Site URL
and I'm not sure what to put for a local development URL to get the proper callback.
How can I resolve this issue?
Upvotes: 3
Views: 631
Reputation: 10376
If you want to test on local host and keep your production environment working:
1- Create a new Facebook app only for development purposes
2- Set the Site URL field to: http://localhost:3000/
3- Then edit your /config/initializers/omniauth.rb file to match the following:
OmniAuth.config.logger = Rails.logger
Rails.application.config.middleware.use OmniAuth::Builder do
if Rails.env.development?
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
provider :facebook, 'DEV_APP_ID', 'DEV_APP_SEVRET'
else
provider :facebook, 'DEPLOY_APP_ID', 'DEPLOY_APP_SECRET'
end
end
Then relaunch rails server
and you should be able to login through your new app.
Upvotes: 1
Reputation: 46703
Just use http://localhost:3000/
as the site url on the Facebook Developers site and it will work just fine with OmniAuth.
Upvotes: 4