gpt4 book ai didi

google-cloud-platform - gcloud auth应用程序默认打印访问 token 错误: "invalid_grant: Bad Request"

转载 作者:行者123 更新时间:2023-12-04 13:18:33 26 4
gpt4 key购买 nike

我正在尝试为Google Cloud Speech做tutorial。我成功完成了前两个步骤。步骤2的响应为:

Activated service account credentials for: [my-service-account@cloud-speech-quickstart.iam.gserviceaccount.com]

第三步说:
3. Obtain an authorization token using your service account:

gcloud auth application-default print-access-token
access_token

我认为这意味着,请转到您的CLI并输入:
gcloud auth application-default print-access-token

我得到以下错误消息:
    ERROR: (gcloud.auth.application-default.print-access-token) There was a problem refreshing your current auth tokens: invalid_grant: Bad Request
Please run:

$ gcloud auth login

to obtain new credentials, or if you have already logged in with a
different account:

$ gcloud config set account ACCOUNT

to select an already authenticated account to use.

我想这是告诉我进入CLI并输入:
gcloud auth login

然后打开一个网页,显示:
Choose an account
to continue to Google Cloud SDK

我选择了我的Google帐户,它转到一个屏幕,显示:
Google Cloud SDK wants to
View and manage your applications deployed on Google App Engine More info
View and manage your Google Compute Engine resources More info
View and manage your data across Google Cloud Platform services More info
Allow Google Cloud SDK to do this?

我单击 Allow,它会显示一个屏幕,显示
You are now authenticated with the Google Cloud SDK!

但是,该网页没有给我访问 token 。回到命令行,我收到以下消息:
You are now logged in as [thomasdkehoe@gmail.com].
Your current project is [cloud-speech-quickstart].

看起来不错,但仍然没有访问 token 。如果我重新进入
gcloud auth application-default print-access-token

我收到原始错误消息。有什么方法可以摆脱这种循环吗?我应该尝试 gcloud auth revoke吗?

最佳答案

这只是发生在我身上,事实证明我需要做
gcloud auth application-default login
(而不是gcloud auth login-这不再写应用程序默认的凭据。原始错误消息不正确)。

FWIW将服务帐户用于应用程序默认凭据,我不得不GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account_key_file.json

关于google-cloud-platform - gcloud auth应用程序默认打印访问 token 错误: "invalid_grant: Bad Request",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45577973/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com