if Rails.env == 'development' || Rails.env == 'test'
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, 'DEV_APP_ID', 'DEV_APP_SECRET'
end
else
# Production
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, 'PRODUCTION_APP_ID', 'PRODUCTION_APP_SECRET'
end
end
I prefer this method because once it's set up, coworkers and other machines don't have additional setup.
使用“ Site URL:”和“ Mobile Site URL:”分别保存生产和开发 URL。两个站点都将被允许进行身份验证。我只是使用 Facebook 进行认证,所以我不需要任何移动站点的重定向功能。我通常在测试身份验证时将“ Mobile Site URL:”更改为“ localhost: 12345”站点,然后在完成后将其设置为正常。