Ruby on rails google oauth的重定向uri不匹配

Ruby on rails google oauth的重定向uri不匹配,ruby-on-rails,spree,google-oauth,Ruby On Rails,Spree,Google Oauth,我很抱歉这个问题被问了很多次,我看到了很多答案,并与他们进行了反复核对,但没有运气。以下是我遵循的程序 1) 转到google开发者控制台 2) 单击“创建凭据” 3) Oauth客户端id 4) Web应用程序 在我提供的原创重定向uri中https://www.example.com/home 我得到了客户id,客户机密的弹出窗口。在这里我添加了它们 Spree::AuthenticationMethod.where(environment: Rails.env, provider: 'go

我很抱歉这个问题被问了很多次,我看到了很多答案,并与他们进行了反复核对,但没有运气。以下是我遵循的程序

1) 转到google开发者控制台
2) 单击“创建凭据”
3) Oauth客户端id
4) Web应用程序
在我提供的原创重定向uri中
https://www.example.com/home

我得到了客户id,客户机密的弹出窗口。在这里我添加了它们

Spree::AuthenticationMethod.where(environment: Rails.env, provider: 'google_oauth2').first_or_create do |auth_method|
    auth_method.api_key = ENV['GOOGLE_ID']
    auth_method.api_secret = ENV['GOOGLE_SECRET']
    auth_method.active = true
  end
现在我使用以下代码调用GoogleOAuth

 <a href="https://www.example.com/users/auth/google_oauth2">
     <div>
       Sign up with google
     </div>
 </a>
这是请求

Request Details
access_type=offline
scope=email
response_type=code
redirect_uri=https://www.example.com/users/auth/google_oauth2/callback
state=31ad247324b285fdf6102e931707e041770a85990050eb40
client_id=490969266456-ki43pu8ejosstkuv01jadmmmt1o33the.apps.googleuserc
看到上面的消息后
我进入控制台,将重定向uri更新为。但我还是犯了同样的错误

所以发生的问题是,我创建了一个没有正确重定向uri的帐户。我把它放在这里了

Spree::AuthenticationMethod.where(environment: Rails.env, provider: 'google_oauth2').first_or_create do |auth_method|
    auth_method.api_key = ENV['GOOGLE_ID']
    auth_method.api_secret = ENV['GOOGLE_SECRET']
    auth_method.active = true
  end
后来我知道了,我必须在控制台中放置正确的回调url,我创建了一个新的凭据。并在.env文件中更新了它们

但它似乎没有在Spree::AuthenticationMethod.all.中更新它们。。前面的键出现了。因此,我删除了这些记录并执行了
rails s

新的按键出现在rails控制台中

另一点要记住的是

当你这样要求的时候 href=”https://www.example.com/users/auth/google_oauth2“>您在谷歌控制台中的回拨uri应该如下所示


所以发生的问题是,我创建了一个没有正确重定向uri的帐户。我把它放在这里了

Spree::AuthenticationMethod.where(environment: Rails.env, provider: 'google_oauth2').first_or_create do |auth_method|
    auth_method.api_key = ENV['GOOGLE_ID']
    auth_method.api_secret = ENV['GOOGLE_SECRET']
    auth_method.active = true
  end
后来我知道了,我必须在控制台中放置正确的回调url,我创建了一个新的凭据。并在.env文件中更新了它们

但它似乎没有在Spree::AuthenticationMethod.all.中更新它们。。前面的键出现了。因此,我删除了这些记录并执行了
rails s

新的按键出现在rails控制台中

另一点要记住的是

当你这样要求的时候 href=”https://www.example.com/users/auth/google_oauth2“>您在谷歌控制台中的回拨uri应该如下所示


您是否收到错误?是标题是我收到的错误,我应该在url中发送客户端id?您收到错误吗?是标题是我收到的错误,我应该在url中发送客户端id?