首页 > 解决方案 > 在最新的 Google Cloud SDK 291.0.1 中无法通过 REST API 获取 access_token 信息

问题描述

我们正在使用 REST API 调用来获取服务帐户的访问令牌

Invoke-RestMethod -Method Get -Uri "https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=$($token)

调用一直在正常工作,但它开始失败并出现错误 - 无法获取访问令牌:

2020-05-18T07:09:55.6584502Z Failed to get access_token information, see the exception bellow

2020-05-18T07:09:55.6585859Z System.Net.WebException: The remote server returned an error: (400) Bad Request.

2020-05-18T07:09:55.6586831Z    at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)

2020-05-18T07:09:55.6587756Z    at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()

经调查,在最新的google cloud sdk中调用可能失败。

谷歌云 SDK 290.0.1 bq 2.0.56 核心 2020.04.24 gsutil 4.49

谷歌云 SDK 291.0.0 bq 2.0.57 核心 2020.05.01 gsutil 4.50

标签: google-apigoogle-oauthgcloud

解决方案


推荐阅读