【问题标题】:How to fix Google Sites Feed API?如何修复 Google Sites Feed API?
【发布时间】:2019-04-26 11:55:11
【问题描述】:

我有一个项目,其中 Google 协作平台 API 在 2019 年 3 月停止工作。我不断收到以下错误消息。

我已经检查了一些必要的事情,例如启用了 API、范围和启用了 Google Admin API 访问。

[26-Apr-2019 13:42:02 Europe/Minsk] PHP 致命错误:未捕获的异常“Google_Auth_Exception”,消息“刷新 OAuth2 令牌时出错,消息:'{ “错误”:“未授权客户端”, “error_description”:“客户端未授权使用此方法检索访问令牌,或者客户端未授权任何请求的范围。” }

  1. google-api-php-client\src\Google\Auth\OAuth2.php(314): Google_Auth_OAuth2->refreshTokenRequest(Array)
  2. google-api-php-client\src\Google\Auth\OAuth2.php(239): Google_Auth_OAuth2->refreshTokenWithAssertion()
  3. google-api-php-client\src\Google\Service\Resource.php(214): Google_Auth_OAuth2->sign(Object(Google_Http_Request))
  4. google-api-php-client\src\Google\Service\Directory.php(1703): Google_Service_Resource->call('list', Array, 'Google_S in google-api-php-client\src\Google\ Auth\OAuth2.php 在第 363 行

我没有对我的代码和 Google Developer Console 中的凭据或 G Suite 进行任何更改。 API 突然停止工作可能出了什么问题?

非常感谢您。

【问题讨论】:

    标签: php google-api


    【解决方案1】:

    在使用 Google 站点 API 的 NodeJS 脚本中得到了同样令人惊讶的行为。

    在 GSuite 开发者管理控制台中,Google 协作平台的某些范围在几个月前已被删除 (!),必须用新的范围替换:

    这个hint 帮助了我。使用“旧”作用域时,使用 OAuth 2 API playground 会显示更精确的错误(提供的旧作用域无效

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多