0

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.

Community
  • 1
  • 1
AJcodez
  • 31,780
  • 20
  • 84
  • 118
  • 1
    What is the error that you get locally? That would really help narrow down the problem. In the meantime, try this solution: http://stackoverflow.com/a/8102001/1160916 – Ashitaka Aug 21 '12 at 03:21
  • I dont get any error locally- it works perfectly on my mac. Thanks for the pointer tho I'll try it – AJcodez Aug 21 '12 at 06:39
  • I wasn't satisfied with my attempt to solve this so I googled and found this: http://stackoverflow.com/questions/9763078/firefox-only-fb-login-called-before-fb-init – Ashitaka Aug 23 '12 at 01:07

1 Answers1

0

The problem was that I misspelled a variable. The code was fine...

Thanks @Ashitaka for your double-effort in helping me!

AJcodez
  • 31,780
  • 20
  • 84
  • 118