Hey so I cannot seem to get Facebook, OmniAuth, Rails, and Heroku to play together. Everything works fine locally.
The Problem
What happens? It just doesnt do anything at all when I click login. On Firebug, locally it shows a Facebook Oauth request got fired, but on the real site no such request happens. Instead in console I get the message FB.login() called before FB.init()
.
When I change the url on Facebook and try to login locally, I get an error message from Facebook which means a request happened. So, I think the issue has something to do with certificates.
This didnt solve it: omniauth with facebook not working on production, although Im not sure what to put in for permissions. I don't use any extended fb graph permissions and it worked locally without specifying any (see initializer below).
My Setup
On Facebook under 'Select how your app integrates with Facebook' I have Website with Facebook login
selected and for 'Site URL' I have either the working http://0.0.0.0:3000
or the not working http://mysite.tld
.
Here is my omniath.rb initializer
OmniAuth.config.logger = Rails.logger
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_SECRET'], {
client_options: { ssl: {
ca_file: '/usr/lib/ssl/certs/ca-certificates.crt',
ca_path: "/etc/ssl/certs"
}}
}
end
Also I am using a custom domain name with masking, just fyi in case that is the problem. Again I don't think so because I would get an error screen instead of nothing, but just in case.
Thanks, and I really look forward to any tips or troubleshooting you can suggest! I plan to blog a tutorial on setting all this up once I get it working cause its been a nightmare.