gpt4 book ai didi

ruby-on-rails - Google Oauth SSL错误-SSL_connect返回= 1 errno = 0状态= SSLv3读取服务器证书B : certificate verify failed

转载 作者:行者123 更新时间:2023-12-04 03:43:10 24 4
gpt4 key购买 nike

我正在开发具有社会授权的Rails应用程序。 Facebook和Twitter登录正常,但Google发生了一些奇怪的事情...

我的Google初始值设定项:

  provider :google_oauth2, OAUTH_CONFIG[:google_api_key], OAUTH_CONFIG[:google_api_secret], {
:access_type => 'offline',
:prompt => 'consent',
:scope => 'userinfo.email, userinfo.profile, youtube.readonly'
}

我的错误,当我单击Google登录时看到:
Faraday::Error::ConnectionFailed
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
/Users/bmalets/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/net/http.rb:920:in `connect'
/Users/bmalets/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/net/http.rb:920:in `block in connect'
/Users/bmalets/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/timeout.rb:76:in `timeout'
/Users/bmalets/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/net/http.rb:920:in `connect'
/Users/bmalets/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/net/http.rb:863:in `do_start'
/Users/bmalets/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/net/http.rb:852:in `start'
/Users/bmalets/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/net/http.rb:1369:in `request'
faraday (0.8.8) lib/faraday/adapter/net_http.rb:75:in `perform_request'
faraday (0.8.8) lib/faraday/adapter/net_http.rb:38:in `call'
faraday (0.8.8) lib/faraday/request/url_encoded.rb:14:in `call'
faraday (0.8.8) lib/faraday/connection.rb:253:in `run_request'
oauth2 (0.8.1) lib/oauth2/client.rb:88:in `request'
oauth2 (0.8.1) lib/oauth2/client.rb:131:in `get_token'
oauth2 (0.8.1) lib/oauth2/strategy/auth_code.rb:29:in `get_token'

SSL证书有什么问题?请帮忙

在google搜索结果中,我看到许多类似的答案-更新'openssl'库,重新安装ruby,rvm,更新gemsets,bla-bla和许多其他文件...我尝试了所有尝试,但没有任何帮助。

环境:rails 4.1.6,ruby 2.1.4,OS_X Yosemite

最佳答案

另一个答案是禁用OpenSSL的VERIFY_PEER选项,这意味着您的应用未在验证证书,并且在查询时无法验证是否已连接到Google。这是巨大的安全风险,您永远都不要这样做。

您所描述问题的GitHub存储库上有一个针对google-api-ruby-client(https://github.com/google/google-api-ruby-client/issues/253)的问题。当前的解决方法是将此添加到您的应用程序:

ENV['SSL_CERT_FILE'] = Gem.loaded_specs['google-api-client'].full_gem_path+'/lib/cacerts.pem'

对于Rails应用,您可以将其添加为 config/application.rb中的一行。

关于ruby-on-rails - Google Oauth SSL错误-SSL_connect返回= 1 errno = 0状态= SSLv3读取服务器证书B : certificate verify failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32434363/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com