加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Google Oauth使用omniauth-google-oauth2登录

发布时间:2020-12-17 02:47:07 所属栏目:百科 来源:网络整理
导读:我正在使用gem omniauth-google-oauth2从谷歌Rails应用程序登录. 这些天我收到这个错误: { "error": { "errors": [ { "domain": "usageLimits","reason": "accessNotConfigured","message": "Access Not Configured. Please use Google Developers Console
我正在使用gem omniauth-google-oauth2从谷歌Rails应用程序登录.
这些天我收到这个错误:

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits","reason": "accessNotConfigured","message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
   }
  ],"code": 403,"message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
 }
}

相同的设置适用于localhost,但经常失败,有时会在生产上工作.我不知道发生了什么事?谷歌最近是否在改变API?我只需登录并获取用户信息即可使用哪些API?

解决方法

我们20小时前就开始遇到同样的问题了,但它出现在制作和localhost(使用两个独立的Google帐户)上.奇怪的是,我们能够每3或4次尝试登录,但不是每次都登录.

至于Google最终的API更改,omniauth-google-oauth2上的此问题似乎相关:https://github.com/zquestz/omniauth-google-oauth2/issues/106.但是,此弃用不应在2014年9月之前强制执行.

此外,直接编辑omniauth-google-oauth2 gem并更改以下行:

class GoogleOauth2 < OmniAuth::Strategies::OAuth2
  BASE_SCOPE_URL = "https://www.googleapis.com/auth/"
  DEFAULT_SCOPE = "userinfo.email,userinfo.profile"

对此:

class GoogleOauth2 < OmniAuth::Strategies::OAuth2
  BASE_SCOPE_URL = "https://www.googleapis.com/auth/"
  DEFAULT_SCOPE = "email,profile"

产生了这个错误:

错误:invalid_scope
一些要求的范围无效. {invalid = [https://www.googleapis.com/auth/profile,https://www.googleapis.com/auth/email]}

更新:
引自Lever的电子邮件(hire.lever.co):

“问题成为开放谷歌的认证系统杠杆用来标识用户,昨晚,我们的一些应用程序谁失去了通过他们的谷歌API的OAuth验证用户的能力之间做出了错误朵朵.我们一直在与谷歌沟通我们被告知,该版本于太平洋夏令时间上午11:30恢复.“

Google OAuth现在似乎已为我们修复.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读