gpt4 book ai didi

google-cloud-platform - 打开我的 Google Cloud Run 服务的 URL 时出现 401 未经授权的错误

转载 作者:行者123 更新时间:2023-12-05 07:23:45 25 4
gpt4 key购买 nike

我构建了一个示例容器(Go 示例,https://cloud.google.com/run/docs/quickstarts/build-and-deploy)并部署到云运行(我取消选中“允许未经身份验证的调用”)。

但是,当我打开我的服务的端点 URL 时,我得到一个 401 页面,

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>401 Unauthorized</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Unauthorized</h1>
<h2>Your client does not have permission to the requested URL <code>/</code>.</h2>
<h2></h2>
</body></html>
curl -H "Authorization: Bearer $(gcloud config config-helper --format 'value(credential.id_token)')" [SERVICE_URL]
  • 我的用户帐户有“roles/run.invoker”
  • 当我选中“允许未经身份验证的调用”时,我得到了预期的结果。

有什么可以打开端点的吗?

最佳答案

  1. 请通过“gcloud --version”确保 gcloud 版本至少为 243.0.0

  2. 如果gcloud太旧,请使用“gcloud components update”进行更新

  3. [已更新] 在 Cloud Shell 中使用 gcloud 调用需要身份验证的 Cloud Run 服务现在也可以正常工作。

谢谢!

关于google-cloud-platform - 打开我的 Google Cloud Run 服务的 URL 时出现 401 未经授权的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55823888/

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