如何修复Google Sites Feed API? [英] How to fix Google Sites Feed API?

查看:92
本文介绍了如何修复Google Sites Feed API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a project where the Google Sites API stopped working in March 2019. I am continuously getting the following error message.

我已经检查了必要的事情,例如启用了API,范围和启用了Google Admin API访问权限.

I have checked necessary things like API is enabled, scopes and Google Admin API access enabled.

[26-Apr-2019 13:42:02欧洲/明斯克] PHP致命错误:未捕获的异常'Google_Auth_Exception'出现消息'刷新OAuth2令牌时出错,消息:'{ 错误":"unauthorized_client", "error_description":未授权客户端使用此方法检索访问令牌,或者未授权客户端进行任何请求的作用域." }

[26-Apr-2019 13:42:02 Europe/Minsk] PHP Fatal error: Uncaught exception 'Google_Auth_Exception' with message 'Error refreshing the OAuth2 token, message: '{ "error": "unauthorized_client", "error_description": "Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested." }

  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 \ 363行上的Auth \ OAuth2.php
  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 on line 363

我尚未对我的代码以及Google Developer Console或G Suite中的CREDENTIALS进行任何更改. API突然停止工作可能会出什么问题?

I have not made any changes to my code and to the CREDENTIALS in the Google Developer Console or to the G Suite. What could have gone wrong for the API to stop working suddenly?

非常感谢您.

推荐答案

使用Google Sites API的NodeJS脚本具有相同的令人惊讶的行为.

Got the same surprising behavior with a NodeJS script using Google Sites API.

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

In GSuite developer admin console, some scopes for Google Sites have been removed (!) a few months ago, and must be replaced by a new one:

  • https://console.developers.google.com
  • 进行身份验证
  • 在顶部栏中,选择与您的应用相对应的项目
  • 在顶部的搜索字段中,输入" Marketplace SDK "
  • 选择选项 G Suite Marketplace SDK
  • 转到配置
  • OAuth 2.0范围部分中,删除范围:

  • Authenticate to https://console.developers.google.com
  • In the top bar, choose the project corresponding to your app
  • In the search field at the top, type "Marketplace SDK"
  • Choose option G Suite Marketplace SDK
  • Go to Configuration
  • In section OAuth 2.0 scopes remove scopes:

https://sites.google.com/feeds/site https://sites.google.com/feeds/activity https://sites.google.com/feeds/content

添加范围:

https://sites.google.com/feeds

点击保存更改

提示帮助了我.使用 OAuth 2 API Playground 时,使用旧"范围(提供了无效的旧版范围)

This hint helped me. Using the OAuth 2 API playground shown a much more precise error when using an "old" scope (Invalid legacy scope provided)

这篇关于如何修复Google Sites Feed API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆