简体   繁体   English

从命令行激活 gcloud 服务帐户时出错

[英]Error while activating the gcloud service account from command line

I'm referring to this URL https://cloud.google.com/speech/docs/getting-started to get started with the google speech API. As the site suggests,I followed the following steps我指的是这个 URL https://cloud.google.com/speech/docs/getting-started开始使用谷歌语音 API。正如网站所建议的,我按照以下步骤操作

  • Create or select a project.创建或 select 一个项目。
  • Enable the Cloud Speech API for that project为该项目启用云语音 API
  • Create a service account创建服务帐号
  • Download a private key as JSON下载私钥为 JSON

I have the gcloud installed on my command-line.我在命令行上安装了 gcloud。 Now when i try to activate service account using the below command,现在,当我尝试使用以下命令激活服务帐户时,

gcloud auth activate-service-account --key-file=my-service-account-key-file gcloud auth activate-service-account --key-file=我的服务账户密钥文件

i'm getting the below error.我收到以下错误。

ERROR: (gcloud.auth.activate-service-account) There was a problem refreshing your current auth tokens: invalid_grant: Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe.错误:(gcloud.auth.activate-service-account)刷新您当前的身份验证令牌时出现问题:invalid_grant:无效 JWT:令牌必须是短期令牌(60 分钟)并且在合理的时间范围内。 Check your iat and exp values and use a clock with skew to account for clock differences between systems.检查您的 iat 和 exp 值,并使用带有偏差的时钟来解决系统之间的时钟差异。

I suspect it's the problem with the time zone.我怀疑这是时区的问题。 I'm running the command from my AWS EC2 instance.我正在从我的 AWS EC2 实例运行命令。

I think there is a cache with this somewhere, after around 10 minutes it resolved itself.我认为某处有一个缓存,大约 10 分钟后它自行解决。

I ran into this error when I created a new key for a service account and deleted the old one.当我为服务帐户创建新密钥并删除旧密钥时遇到此错误。

In my case fixing the date solved the issue.在我的例子中,确定日期解决了这个问题。 If you are in linux, you can change the date by executing如果你在 linux,你可以通过执行来更改日期

date -s "Thu Feb 24 22:32:36 EET 2022"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase Gcloud: 服务账号,私钥生成错误 - Firebase Gcloud : Service account, Private key generation error 错误:(gcloud.auth.activate-service-account).json 密钥文件格式无效——通过模拟服务帐户 - ERROR: (gcloud.auth.activate-service-account) The .json key file is not in a valid format -- via impersonate-service-account 使用 gcloud 服务帐号登录 firebase - Login to firebase using gcloud service account 错误:(gcloud.auth.activate-service-account)无法激活给定的服务帐户。 请确保提供的密钥文件有效 - ERROR: (gcloud.auth.activate-service-account) Failed to activate the given service account. Please ensure provided key file is valid Appengine gcloud 部署使用自定义服务帐户 - Appengine gcloud deploy using custom service account 来自 Firebase 和来自 GCloud 的 Firebase 服务帐户密钥文件之间的区别? - Difference between Firebase service account key files from Firebase and from GCloud? 使用“gcloud run deploy”时,如何使用命令行参数指定服务名称? - When using 'gcloud run deploy', how can I specify the service name with command line args? 从命令行部署 App Engine 标准项目时出错 - Error while deploying App Engine standard project from command line 错误:(gcloud.builds.submit)错误 403:<service account> 没有 storage.objects.get 访问谷歌云存储 object</service> - ERROR: (gcloud.builds.submit) Error 403: <SERVICE ACCOUNT> does not have storage.objects.get access to the Google Cloud Storage object gcloud auth activate-service-account 有什么限制 - What are the limitations on gcloud auth activate-service-account
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM