Rails Google Oauth2-传统人API未在项目中使用

问题描述 投票:0回答:1

我正在使用omniauth google oauth2 gem为Google oauth2设置应用程序。我目前有另一个使用不同oauth提供程序的模型,因此这需要我进行一些配置。

我能够很好地配置该应用程序,并且可以按路线localhost:3000/auth/google_oauth2转到Google身份验证提示。从那里,我选择我的Google帐户,它尝试重定向到我的回调,但是却收到此错误

{
  "error": {
    "code": 403,
    "message": "Legacy People API has not been used in project <PROJECT_ID> before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/legacypeople.googleapis.com/overview?project=<PROJECT_ID> then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.Help",
        "links": [
          {
            "description": "Google developers console API activation",
            "url": "https://console.developers.google.com/apis/api/legacypeople.googleapis.com/overview?project=<PROJECT_ID>"
          }
        ]
      }
    ]
  }
}

当我转到Google开发者控制台中https://console.developers.google.com/apis/api/legacypeople.googleapis.com/overview?project=<PROJECT_ID>提供的链接时,我从Google收到此错误

There was an error while loading /apis/api/legacypeople.googleapis.com/overview?project=<PROJECT_ID>. Please try again.

之所以有意义,是因为该API已不再使用。在我在Google上的项目中,我启用了以下API:

  • 联系人API
  • Google+ API
  • People API

为了收集我在网上找到的东西,将其拼凑起来。但是,目前这些都不起作用。

有人知道我如何通过Google oauth2 Legacy People API错误吗?

ruby-on-rails-4 oauth-2.0 google-oauth2
1个回答
0
投票

将omniauth-google-oauth2更新为0.8.0或更高版本可避免错误:

 bundle update --source omniauth-google-oauth2

参考https://github.com/zquestz/omniauth-google-oauth2/issues/377

© www.soinside.com 2019 - 2024. All rights reserved.