自从更新后,使用应用默认凭据的Appengine远程API Shell无法工作

6

我最近将gcloud库从118.0.0更新到132.0.0,结果远程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之后没有更新运行中的应用程序,因为我目前正在发布周期中,所以可能会出现问题,但如果有任何帮助,将不胜感激。谢谢!

1个回答

12

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命令的更改而导致的。根据Google的tokeninfo端点,旧令牌具有以下作用域:

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 的新令牌,在不添加任何选项的情况下只包含:

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的讨论。


谢谢,这看起来非常有前途。你是否知道在Google方面是否存在与此相关的开放问题,无论是代码还是文档? - snakecharmerb
我不知道是否存在这样的情况。我在应用引擎Google Group上发布了帖子,试图引起一些注意。我对公共问题跟踪器没有太多信心:https://groups.google.com/forum/#!topic/google-appengine/ptc-76K6Kk4 - Evan Jones
1
这也是Firebase REST API的一个问题,请参见http://stackoverflow.com/questions/40443525/firebase-applicationdefaultcredentials-doesnt-work-in-dev-appserver/40539525#40539525。 - Andrew Stromme

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接