omn​​iauth 与 facebook 不进行生产 [英] omniauth with facebook not working on production

查看:25
本文介绍了omn​​iauth 与 facebook 不进行生产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的 rails 应用程序中使用 omniauth,我使用 facebook 和 twitter 按钮签名,当我将 facebook 放入站点 url 提交 localhost:3000 时,一切正常,但是当我上传站点到 heroku 并将站点 url 更改为 sitename.heroku.com,twiiter 登录按钮有效但 facebook 按钮不起作用...

i'm working with omniauth in my rails app, i have sign with facebook and twitter button, when i'm putting in facebook in the site url filed localhost:3000, all is working, but when i'm uploading the site to heroku and changing in the site url to sitename.heroku.com, the twiiter login button working but the facebook button don't working...

推荐答案

您可能需要向我们提供更多信息(您的意思是 facebook 按钮不起作用?您是否收到错误消息?如果是,是什么?你的日志在说什么?)

You probably need to give us more information (What do you mean the facebook button isn't working? Are you getting an error message? If so, what? What are your logs saying?)

但是,这很有可能是您的问题:在 heroku 上使用 omniauth facebook 身份验证存在一个已知问题.您需要在 config/initializers/omniauth.rb 文件中添加对 SSL 证书文件的显式引用.更改您的 facebook 配置行以包含client_options"哈希,如下所示:

BUT, there's a good chance this is your problem: there is a known issue using omniauth facebook authentication on heroku. You need to add an explicit reference to the SSL certificates file in the config/initializers/omniauth.rb file. Change your facebook config line to include the 'client_options' hash like so:

provider :facebook, 'YOUR_APP_ID', 'YOUR_SECRET_KEY', 
           {:scope => 'PERMISSION_1, PERMISSION_2, PERMISSION_3...', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}

这篇关于omn​​iauth 与 facebook 不进行生产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆