php - 谷歌网站管理员 API : How to impersonate using server to server request?

标签 php google-api google-api-php-client google-search-console google-api-webmasters

我可以使用通过网络服务请求授予的访问 token 访问网站管理员的 google API 网站列表,现在我想通过服务器到服务器请求来完成.

在授予服务器帐户访问列表的权限后,我无法使用以下范围正确使用 setAssertionCredentials:

'https://www.googleapis.com/auth/webmasters'

案例一

模拟用户帐户时:

$cred->sub = 'user.account@gmail.com';

PHP 客户端返回

'Error refreshing the OAuth2 token, message: '{ "error" : "unauthorized_client", "error_description" : "Unauthorized client or scope in request." }

案例二

如果不模拟用户帐户,PHP 客户端会得到一个空数组

问题

如何使用服务器模拟用户向 Google 发送网站管理员 API 请求?

没有回答的相关内容

最佳答案

我会说通过服务器到服务器的请求来完成它会带来一些麻烦。

因为您可以通过网络服务请求获得它,您可以启动一个外部触发器到您的 php 函数和 put the data in json on Google Cloud Storage (GCS) as public ,因此您可以通过服务器到服务器请求访问所需的数据,并在完成后立即将其删除。

关于php - 谷歌网站管理员 API : How to impersonate using server to server request?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30286479/

相关文章:

java - 如何使用套接字将文件从php客户端发送到java服务器

flutter - 在向 Google Route API 发送 HTTP Post 请求期间发生错误,

google-api - 使用圆形边框和切片边距自定义 Google Visualization PieChart 外观

php - 您需要授权访问才能继续

google-analytics - Google Analytics API V3-HTTP错误:无法在实时服务器上连接(localhost运行正常)

php - 使用 php 获取谷歌分析实时数据

php - ??的正确用法运算符(operator)

php - 使用选项列表作为 Ajax 调用上的链接

php - JQUERY getJSON/ajax 响应未处理

javascript - 使用谷歌地图感知地理位置