0

Login with Fb worked fine when I was hosting locally but I'm having issues now that it's on heroku. I already updated the domain on FB associated with my app from localhost:3000 to myapp.herokuapp.com

I've also checked out this thread omniauth with facebook not working on production and tried adding the 'client_options' hash to my initializer file and am still having trouble. I don't know if this is relevant, but when I try and navigate to /usr/lib/ssl/certs/ca-certificates.crt I get a "No such file or directory" error.

When I click login to FB on my app (http://playedbyme.herokuapp.com/) I get a callback error.

Here is what my OmniAuth initializer file looks like:

  Rails.application.config.middleware.use OmniAuth::Builder do
    provider :facebook, 'MY_APP_ID', 'MY_SECRET_KEY',
      {:client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}
  end

UPDATE: I think that it's some sort of issue with my database. When I run "heroku run rake db:migrate" I get an error

   rake aborted!
   An error has occurred, this and all later migrations canceled:
   PG::Error: ERROR:  column "id" of relation "parties" already exists
   : ALTER TABLE "parties" RENAME COLUMN "party_id" TO "id"

But, I don't have a column named party_id in my Parties table

Community
  • 1
  • 1
bsiddiqui
  • 1,886
  • 5
  • 25
  • 35

1 Answers1

0

You need to make sure your CA certs path is correct. You can check that on your heroku servers by running:

heroku run bash

and then running openssl to display the proper path:

$ openssl version -a
 OpenSSL 1.0.0e 6 Sep 2011 
 OPENSSLDIR: "/usr/lib/ssl"

You should find the ca_certificates.crt file at $OPENSSLDIR/certs/ca-certificates.crt

Make sure you are also specifying your Facebook permissions in scope as per omniauth setup in config/initializers/omniauth.rb:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, 'YOUR_APP_ID', 'YOUR_SECRET_KEY',
           {:scope => 'PERMISSION_1, PERMISSION_2, ETC', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}
end

Also ensure you restart rails after making changes to this file.

Edit

To fix your DB problem, you may want to look at resetting your DB and recreating it:

heroku pg:reset DATABASE --confirm YOUR_APP_NAME
heroku run rake db:setup
heroku restart
heroku open
mccannf
  • 16,619
  • 3
  • 51
  • 63
  • I did that and got this: OpenSSL 0.9.8k 25 Mar 2009 built on: Thu Feb 10 01:45:33 UTC 2011 platform: debian-amd64 options: bn(64,64) md2(int) rc4(ptr,char) des(idx,cisc,16,int) blowfish(ptr2) compiler: cc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -DTERMIO -O3 -Wa,--noexecstack -g -Wall -DMD32_REG_T=int -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM OPENSSLDIR: "/usr/lib/ssl" ~ $ Doesn't that mean I have the correct path? – bsiddiqui Dec 10 '12 at 00:58
  • Hmm - can you also try the path `/etc/ssl/certs/ca-certificates.crt`? This is another possible location for the file. – mccannf Dec 10 '12 at 08:48
  • Edited for some other things to try - I believe `/usr/lib/ssl/certs` is the right location :( – mccannf Dec 10 '12 at 09:11
  • Checked out /etc/ssl/certs/ca-certificates.crt - no file or directory. Should I be able to open /usr/lib/ssl/certs in terminal? – bsiddiqui Dec 10 '12 at 15:32
  • I think I'm having some sort of problem with my database – bsiddiqui Dec 10 '12 at 15:55