Invalid Auth Token when auth token is expired after 12h
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python
- 领域
- api, authentication
调研方向
从 cloudfoundry_client/client.py 开始,重点查看 init_with_client_credentials 路径以及第 271 行和第 309 行的请求处理,然后将行为与 pull request #88 进行比较。在 token 过期后重现 v3 请求;完成的标准是,过期 token 场景不再产生报告中的 unauthorized failure。
由索引模型根据 Issue 内容生成。
描述
Hi,
we are using cloudfoundry-client==1.30.0.
Our code is part of a servicebroker with the openbrokerapi framework.
We are trying to access the cf api with a client_id and a client_secret.
Our code is as follows in the constructor:
self._client = CloudFoundryClient(url, verify=cacert_path, client_id=client_id, client_secret=client_secret)
self._client.init_with_client_credentials()
to access one result we later use:
app_guid_response = self._client.v3.apps.get(app_guid)
If the login with init_with_client_credentials() is more than 12h ago, the token expires and accessing the api fails with:
2022-08-18T08:20:42.746+02:00 [APP/PROC/WEB/0] [OUT] {"message": "GET: url=https://our.cf.api/v3/service_credential_bindings/9f103727-baab-464f-887e-f28d084119c0 - status_code=401 - vcap-request-id=e395a697-22ba-495c-9213-1667df377148::edc717be-bcd4-4f8a-b8eb-65ded1283297 - response={\n \"errors\": [\n {\n \"detail\": \"Invalid Auth Token\",\n \"title\": \"CF-InvalidAuthToken\",\n \"code\": 1000\n }\n ]\n}", "time": "2022-08-18T06:20:42.746518"}
2022-08-18T08:20:42.746+02:00 [APP/PROC/WEB/0] [ERR] DEBUG:cloudfoundry_client.client:GET: url=https://our.cf.api/v3/service_credential_bindings/9f103727-baab-464f-887e-f28d084119c0 - status_code=401 - vcap-request-id=e395a697-22ba-495c-9213-1667df377148::edc717be-bcd4-4f8a-b8eb-65ded1283297 - response={
2022-08-18T08:20:42.746+02:00 [APP/PROC/WEB/0] [ERR] "errors": [
2022-08-18T08:20:42.746+02:00 [APP/PROC/WEB/0] [ERR] {
2022-08-18T08:20:42.746+02:00 [APP/PROC/WEB/0] [ERR] "detail": "Invalid Auth Token",
2022-08-18T08:20:42.746+02:00 [APP/PROC/WEB/0] [ERR] "title": "CF-InvalidAuthToken",
2022-08-18T08:20:42.746+02:00 [APP/PROC/WEB/0] [ERR] "code": 1000
2022-08-18T08:20:42.746+02:00 [APP/PROC/WEB/0] [ERR] }
2022-08-18T08:20:42.746+02:00 [APP/PROC/WEB/0] [ERR] ]
2022-08-18T08:20:42.746+02:00 [APP/PROC/WEB/0] [ERR] }
The stacktrace is part of some more elements, here are the parts from cloudfoundry-client:
2022-08-18T08:20:42.751+02:00 [APP/PROC/WEB/0] [ERR] service_binding_response = self._client.v3.service_credential_bindings.get(service_binding_guid)
2022-08-18T08:20:42.751+02:00 [APP/PROC/WEB/0] [ERR] File "/home/vcap/deps/0/python/lib/python3.8/site-packages/cloudfoundry_client/v3/entities.py", line 238, in get
2022-08-18T08:20:42.751+02:00 [APP/PROC/WEB/0] [ERR] return self._get(requested_path, **kwargs)
2022-08-18T08:20:42.751+02:00 [APP/PROC/WEB/0] [ERR] File "/home/vcap/deps/0/python/lib/python3.8/site-packages/cloudfoundry_client/v3/entities.py", line 133, in _get
2022-08-18T08:20:42.751+02:00 [APP/PROC/WEB/0] [ERR] response = self.client.get(url_requested)
2022-08-18T08:20:42.751+02:00 [APP/PROC/WEB/0] [ERR] File "/home/vcap/deps/0/python/lib/python3.8/site-packages/cloudfoundry_client/client.py", line 271, in get
2022-08-18T08:20:42.751+02:00 [APP/PROC/WEB/0] [ERR] return CloudFoundryClient._check_response(response)
2022-08-18T08:20:42.751+02:00 [APP/PROC/WEB/0] [ERR] File "/home/vcap/deps/0/python/lib/python3.8/site-packages/cloudfoundry_client/client.py", line 309, in _check_response
2022-08-18T08:20:42.751+02:00 [APP/PROC/WEB/0] [ERR] raise InvalidStatusCode(HTTPStatus(response.status_code), body, response.headers.get("x-vcap-request-id"))
2022-08-18T08:20:42.751+02:00 [APP/PROC/WEB/0] [ERR] cloudfoundry_client.errors.InvalidStatusCode: UNAUTHORIZED = {"errors": [{"detail": "Invalid Auth Token", "title": "CF-InvalidAuthToken", "code": 1000}]} - vcap-request-id = e395a697-22ba-495c-9213-1667df377148::edc717be-bcd4-4f8a-b8eb-65ded1283297
I thought https://github.com/cloudfoundry-community/cf-python-client/pull/88 was supposed to fix that problem?
Thanks!
- Lorenz
- 主要语言
- Python
- 星标
- 55
- 派生
- 54
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cloudfoundry-community/cf-python-client 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 45/100
cloudfoundry-community/cf-python-client#218 · 3 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
cloudfoundry-community/cf-python-client#180 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 30/100
cloudfoundry-community/cf-python-client#170 · 2 条评论 ·
查看 cloudfoundry-community/cf-python-client 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
huggingface/sentence-transformers#4186 ·
维护者通常 5 天内回复
-
documentation good first issue
难度 2/5 半天 新手友好度 72/100
sujithputta02/Esapay#13 ·
-
bot-triaged module: correctness (silent) module: mps module: NaNs and Infs triage review
难度 2/5 半天 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
SCIInstitute/SCIRun#2842 ·
维护者通常 3 天内回复