Twitter 的 Omniauth 服务不可用错误
我正在使用omniauth 和twitter 登录我的网站。但是,每当我尝试登录时,都会出现以下错误:
Started GET "/auth/failure?message=service_unavailable" for 98.83.218.118 at 2011-11-12 11:27:58 -0500
Processing by SessionsController#failure as HTML
Parameters: {"message"=>"service_unavailable"}
我唯一的线索是它可能是 SSL 错误。
但是,我不知道如何调试错误原因。
这是我当前的 Twitter 配置:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :twitter, 'REDACTED', 'REDACTED'
end
I am using omniauth and twitter login for my site. However, whenever I try to login, it gave this error:
Started GET "/auth/failure?message=service_unavailable" for 98.83.218.118 at 2011-11-12 11:27:58 -0500
Processing by SessionsController#failure as HTML
Parameters: {"message"=>"service_unavailable"}
The only clue I have is that it might be an SSL error.
However, I have no idea on how to debug the cause of the error.
Here is my current configuration for twitter:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :twitter, 'REDACTED', 'REDACTED'
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它看起来像我的项目中的 ssl 问题。
对于开发模式,您可以关闭 ssl。然后你就可以在没有这个问题的情况下工作了。
在 develoment.rb 中添加以下内容:
以及如何修复 SSL 证书:
Twitter API SSL 根 CA 证书
It looks like ssl issue in my project.
For development mode you can off ssl. Then you can work without this issue.
add this in develoment.rb:
And about how fix SSL certificates:
Twitter API SSL Root CA Certificate
我不太喜欢 Twitter 开发支持中建议的解决方案(由 Yahor Zhuchkou 链接),该解决方案建议从不安全的服务器下载一堆证书。
虽然关闭验证对等点可以在生产中工作,但这并不是真正的解决方案。您需要做的是将omniauth指向正确的PEM文件,该文件应包含类似Verisign根证书的内容,该证书支持Twitter自己的证书(i:/C=US/O=VeriSign, Inc./OU=Class 3 Public主要证书颁发机构 - G2/OU=(c) 1998 VeriSign, Inc. - 仅供授权使用/OU=VeriSign 信任网络):(
如果您使用的是 Ubuntu,您可以在此处找到它:
/etc/ssl/certs/Verisign_Class_3_Public_Primary_Certification_Authority__-_G2.pem
)不知道为什么omniauth或ruby openssl实现没有找到这个,但您可以使用以下选项显式链接到此pem文件:
I don't really like the solution suggested in at twitter dev support (as linked by Yahor Zhuchkou), which suggest downloading just a bunch of certificates from an unsecure server.
And while turning of verify peer will work in production that isn't really a solution. What you need to do is to point omniauth to the correct PEM file, which should contain something like, the Verisign Root Certificate which backs Twitter's own certificate (i:/C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority - G2/OU=(c) 1998 VeriSign, Inc. - For authorized use only/OU=VeriSign Trust Network):
(If you're using Ubuntu you may find it here:
/etc/ssl/certs/Verisign_Class_3_Public_Primary_Certification_Authority_-_G2.pem
)Don't know why omniauth or ruby openssl implementation isn't finding this, but you can explicitly link to this pem file with the following option: