2017-08-08 154 views
1

我正在尝试为Google Cloud Speech执行tutorial。我成功完成了前两步。从第2步的反应是:gcloud auth application-default打印访问令牌错误:“invalid_grant:错误的请求”

Activated service account credentials for: [[email protected]om] 

第三步说:

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 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! 
01的屏幕

但是,该网页不给我一个访问令牌。回到命令行我有这样的消息:

You are now logged in as [thomasdkeh[email protected]]. 
Your current project is [cloud-speech-quickstart]. 

这看起来不错,但仍然没有访问令牌。如果我重新输入

gcloud auth application-default print-access-token 

我收到了原始错误消息。有什么办法摆脱这个循环?我应该试试gcloud auth revoke

回答

0

这只是发生在我身上,它原来我需要做的

gcloud auth application-default login

(而不是gcloud auth login - 这一次不再编写应用程序的默认凭据的原始错误消息是不正确)。

FWIW使用的应用程序,默认凭据服务帐户,我不得不这样做 GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account_key_file.json

相关问题