当我尝试使用omniauth 通过 Facebook 进行身份验证时出错
我关注了 Ryan Bates Omniauth Part1 Railscats http://railscasts.com/episodes/235-omniauth-第 1 部分 。我将 twitter 和 Facebook 身份验证与其秘密号码放在一起,当我尝试通过 Facebook (auth/facebook) 进行身份验证时,我收到此错误:
{
"error": {
"message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
"type": "OAuthException"
}
}
当我尝试通过 twitter (auth/twitter) 进行身份验证时,我收到此 401 未经授权的响应。我不知道如何更正它
谢谢我更正了在 Twitter URL 回调字段和 Facebook 我的网站字段中输入的 http://127.0.0.1:3000
。但现在当我尝试使用 Facebook 进行身份验证时,出现此错误:
OpenSSL::SSL::SSLError
SSL_connect 返回=1 errno=0 状态=SSLv3 读取服务器证书 B: 证书验证失败
如何解决?我解决了将 OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
放入development.rb
I followed Ryan Bates Omniauth Part1 railscats http://railscasts.com/episodes/235-omniauth-part-1 . I put twitter and Facebook authentication with their secret numbers and when I try to authenticate through Facebook (auth/facebook) I get this error:
{
"error": {
"message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
"type": "OAuthException"
}
}
And when I try to authenticate through twitter (auth/twitter) I get this 401 Unauthorized response. I don't know how I can correct it
Thanks I corrected entering http://127.0.0.1:3000
in twitter URL callback field and in facebook my website field. But now when I try to authenticate with facebook I get this error:
OpenSSL::SSL::SSLError
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B:
certificate verify failed
How can I solve it? I solved putting OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
in development.rb
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您的服务器在 http 协议上运行时,就会出现该错误。您需要在 APP_PATH 之前的 your_project/script/rails 中添加这段代码
要生成自签名证书,请阅读本教程 http://www.akadia.com/services/ssh_test_certificate.html(步骤 1 到 4)或此 www.tc.umn.edu/~brams006/selfsign.html
更新 Rails 后脚本将 url 从
http://127.0.0.1:3000
更改为https://127.0.0.1:3000
That error appears when your server runs on http protocol. You need to add this piece of code in your_project/script/rails before APP_PATH
To generate self-signed certificates read this tutorial http://www.akadia.com/services/ssh_test_certificate.html (steps 1 to 4) or this www.tc.umn.edu/~brams006/selfsign.html
After updating your rails script change the url from
http://127.0.0.1:3000
tohttps://127.0.0.1:3000
我在开发 Twitter 时经常遇到这个问题。
问题可能是您的应用程序设置中的回调网址。尝试将其设置为:
然后重试。如果从
http://localhost:3000
不起作用,请从http://127.0.0.1:3000
尝试。Facebook的问题也可能是应用程序设置中的回调 URL。对于 Facebook,我的
site url
设置是:http://localhost:3000/
I get this problem fairly often with Twitter in development.
The issue is likely your callback url in your app settings. Try setting it to:
And try again. If it doesn't work from
http://localhost:3000
then try it fromhttp://127.0.0.1:3000
The problem with Facebook is also likely to be the callback URL in the app settings. For Facebook, my
site url
setting is:http://localhost:3000/