Rails 请教 omniauth google 登录时 是好是坏 SSL_connect

ghn645568344 · 2022年11月07日 · 152 次阅读
ruby 3.1.2
rails 7.0.4
本地的docker部署访问
http://127.0.0.1:3000/omniauth/google_oauth2
问题:授权页面可以访问打开,点击按钮后跳转页面时,是好是坏

坏时错误提示如下

Cannot render console from 192.168.128.1! Allowed networks: 127.0.0.0/127.255.255.255, ::1
 [2022-11-07T08:59:37.737410 #1] DEBUG -- omniauth: (google_oauth2) Callback phase initiated.
[2022-11-07T08:59:37.956060 #1] ERROR -- omniauth: (google_oauth2) Authentication failure! SSL_connect SYSCALL returned=5 errno=0 peeraddr=142.251.42.234:443 state=SSLv3/TLS write client hello: Faraday::SSLError, SSL_connect SYSCALL returned=5 errno=0 peeraddr=142.251.42.234:443 state=SSLv3/TLS write client hello
 Faraday::SSLError (SSL_connect SYSCALL returned=5 errno=0 peeraddr=142.251.42.234:443 state=SSLv3/TLS write client hello):
 net-protocol (0.1.3) lib/net/protocol.rb:46:in `connect_nonblock'
net-protocol (0.1.3) lib/net/protocol.rb:46:in `ssl_socket_connect'
 /usr/local/lib/ruby/3.1.0/net/http.rb:1048:in `connect'
 /usr/local/lib/ruby/3.1.0/net/http.rb:976:in `do_start'
 /usr/local/lib/ruby/3.1.0/net/http.rb:965:in `start'
faraday-net_http (3.0.1) lib/faraday/adapter/net_http.rb:112:in `request_with_wrapped_block'

config/initializers/omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :google_oauth2, "xxx",
           "xxxx",
           {
             prompt: 'select_account',
              :scope => "email, profile",
           }
end
OmniAuth.config.allowed_request_methods = [:post, :get]

Controller 文件

class SessionsController < ApplicationController
  def create
    # user = User.from_omniauth(env["omniauth.auth"])
    puts "-------------"
    puts request.env['omniauth.auth']
    data = request.env['omniauth.auth'].info
    puts data
    puts "-------------"
    render json: {code: 200, message:""}

  end

  def destroy
    # session[:user_id] = nil
    redirect_to root_url
  end
end
暂无回复。
需要 登录 后方可回复, 如果你还没有账号请 注册新账号