gpt4 book ai didi

python - 自更新以来,Appengine remote_api_shell 无法使用应用程序默认凭据

转载 作者:太空狗 更新时间:2023-10-29 22:15:09 25 4
gpt4 key购买 nike

我最近将我的 gcloud 库从 118.0.0 更新到 132.0.0,remote_api_shell 立即失效。我经历了一系列重新登录的排列,通过 gcloud 设置应用程序默认凭据,并使用服务帐户和环境变量。所有排列均失败并显示相同的错误消息:

    Traceback (most recent call last):
File "/Users/mbostwick/google-cloud-sdk/bin/remote_api_shell.py", line 133, in <module>
run_file(__file__, globals())
File "/Users/mbostwick/google-cloud-sdk/bin/remote_api_shell.py", line 129, in run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/Users/mbostwick/google-cloud-sdk/platform/google_appengine/google/appengine/tools/remote_api_shell.py", line 160, in <module>
main(sys.argv)
File "/Users/mbostwick/google-cloud-sdk/platform/google_appengine/google/appengine/tools/remote_api_shell.py", line 156, in main
oauth2=True)
File "/Users/mbostwick/google-cloud-sdk/platform/google_appengine/google/appengine/tools/remote_api_shell.py", line 74, in remote_api_shell
secure=secure, app_id=appid)
File "/Users/mbostwick/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 769, in ConfigureRemoteApiForOAuth
rpc_server_factory=rpc_server_factory)
File "/Users/mbostwick/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 839, in ConfigureRemoteApi
app_id = GetRemoteAppIdFromServer(server, path, rtok)
File "/Users/mbostwick/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 569, in GetRemoteAppIdFromServer
response = server.Send(path, payload=None, **urlargs)
File "/Users/mbostwick/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appengine_rpc_httplib2.py", line 259, in Send
NeedAuth()
File "/Users/mbostwick/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appengine_rpc_httplib2.py", line 235, in NeedAuth
RaiseHttpError(url, response_info, response, 'Too many auth attempts.')
File "/Users/mbostwick/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appengine_rpc_httplib2.py", line 85, in RaiseHttpError
raise urllib2.HTTPError(url, response_info.status, msg, response_info, stream)
urllib2.HTTPError: HTTP Error 401: Unauthorized Too many auth attempts.

通过 131.0.0 和 130.0.0 恢复后,我回到 118.0.0,重新登录,一切正常。

更新 gcloud 后我没有更新正在运行的应用程序,因为我目前正处于发布周期的中间,所以这可能是问题所在,但我们将不胜感激。谢谢!

最佳答案

TL;DR:这已在 gcloud 版本 134 中修复

原答案:运行

gcloud auth application-default login --scopes=https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/userinfo.email

现在您的远程 shell 应该再次工作了。

详细信息:我认为这已被 128.0.0 更新以及对 gcloud auth login 命令的更改打破。旧 token 具有以下范围(根据 Google 的 token 信息端点):

https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/appengine.admin https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/plus.me

gcloud auth application-default login 没有任何选项的新 token 只有:

https://www.googleapis.com/auth/cloud-platform

这在 gcloud auth application-default login --help 中有记录

版本 134 详细信息:请求的范围现在是:

https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/cloud-platform

参见 https://groups.google.com/d/msg/google-appengine/ptc-76K6Kk4/9qr4601BBgAJ 的讨论

关于python - 自更新以来,Appengine remote_api_shell 无法使用应用程序默认凭据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40349915/

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