当我在本地托管时,使用 Fb 登录效果很好,但现在我遇到了问题,因为它在 heroku 上。我已经将 FB 上与我的应用关联的域从 localhost:3000 更新为 myapp.herokuapp.com
我还检查了这个线程omniauth with facebook not working on production,并尝试将'client_options'哈希添加到我的初始化文件中,但仍然遇到问题。我不知道这是否相关,但是当我尝试导航到 /usr/lib/ssl/certs/ca-certificates.crt 时,我收到“没有这样的文件或目录”错误。
当我在我的应用程序( http://playedbyme.herokuapp.com/ )上单击登录 FB 时,我收到一个回调错误。
这是我的 OmniAuth 初始化程序文件的样子:
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
更新:我认为这是我的数据库的某种问题。当我运行“heroku run rake db:migrate”时出现错误
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"
但是,我的派对表中没有名为 party_id 的列