Google Cloud Storage HttpAccessTokenRefreshError: invalid_grant: Bad Request
Google Cloud Storage HttpAccessTokenRefreshError: invalid_grant: Bad Request
当我尝试连接到我的任何项目中的 Google Cloud Storage 存储桶时,我收到此错误 oauth2client.client.HttpAccessTokenRefreshError: invalid_grant: Bad Request
(所有项目之前都在工作)。
from gcloud import storage
client = storage.Client()
bucket = client.get_bucket(bucket_name)
我在同事的笔记本电脑上通过命令行登录了我的 gcloud 帐户,脚本连接到云存储正常。然后我的同事在我的电脑上登录了他的 gcloud 帐户,但他也没有用。我们假设这是许多其他帖子提到的服务器时间问题,或者我的电脑出了什么问题。
我们 运行 ntpdate
得到 8 Nov 12:00:38 ntpdate[3468]: no servers can be used, exiting
我们也使用 ntpd
但无济于事。
Project in : Python 2.7 |
OS : MacOS Sierra v 10.12.1 |
Google cloud sdk : 133.0.0
我已经使用 gcloud 检查了我的身份验证,并使用这些命令撤销并重新登录
gcloud auth revoke
和 gcloud auth login
然后按照之后的步骤进行验证。 这些步骤无效。
然后我在 Google 的不太友好的文档中翻了几个小时,然后回到了这个页面:https://googlecloudplatform.github.io/google-cloud-python/stable/google-cloud-auth.html
If you're developing locally, the easiest way to authenticate is using the Google Cloud SDK:
$ gcloud beta auth application-default login
Note that this command generates credentials for client libraries. To authenticate the CLI itself, use:
$ gcloud auth login
我还没有准备好这两个命令之间的区别,但我的所有项目现在又可以工作了。祝你好运
简而言之:
使用 gcloud beta auth application-default login
当我尝试连接到我的任何项目中的 Google Cloud Storage 存储桶时,我收到此错误 oauth2client.client.HttpAccessTokenRefreshError: invalid_grant: Bad Request
(所有项目之前都在工作)。
from gcloud import storage
client = storage.Client()
bucket = client.get_bucket(bucket_name)
我在同事的笔记本电脑上通过命令行登录了我的 gcloud 帐户,脚本连接到云存储正常。然后我的同事在我的电脑上登录了他的 gcloud 帐户,但他也没有用。我们假设这是许多其他帖子提到的服务器时间问题,或者我的电脑出了什么问题。
我们 运行 ntpdate
得到 8 Nov 12:00:38 ntpdate[3468]: no servers can be used, exiting
我们也使用 ntpd
但无济于事。
Project in : Python 2.7 |
OS : MacOS Sierra v 10.12.1 |
Google cloud sdk : 133.0.0
我已经使用 gcloud 检查了我的身份验证,并使用这些命令撤销并重新登录
gcloud auth revoke
和 gcloud auth login
然后按照之后的步骤进行验证。 这些步骤无效。
然后我在 Google 的不太友好的文档中翻了几个小时,然后回到了这个页面:https://googlecloudplatform.github.io/google-cloud-python/stable/google-cloud-auth.html
If you're developing locally, the easiest way to authenticate is using the Google Cloud SDK:
$ gcloud beta auth application-default login
Note that this command generates credentials for client libraries. To authenticate the CLI itself, use:
$ gcloud auth login
我还没有准备好这两个命令之间的区别,但我的所有项目现在又可以工作了。祝你好运
简而言之:
使用 gcloud beta auth application-default login