Invalid Auth Token when auth token is expired after 12h
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- python
- Domínio
- api, authentication
Direção de pesquisa
Comece por cloudfoundry_client/client.py, especialmente pelo caminho init_with_client_credentials e pelo tratamento das requisições nas linhas 271 e 309; em seguida, compare o comportamento com o pull request #88. Reproduza a requisição v3 depois que o token tiver expirado; considera-se concluído quando o cenário de token expirado não produzir mais a falha de autorização não autorizada relatada.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- Python
- Estrelas
- 55
- Forks
- 54
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de cloudfoundry-community/cf-python-client
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
cloudfoundry-community/cf-python-client#218 · 3 comentários ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
cloudfoundry-community/cf-python-client#180 · 2 comentários ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 30/100
cloudfoundry-community/cf-python-client#170 · 2 comentários ·
Todas as issues de cloudfoundry-community/cf-python-client
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
noontide-co/mainbranch#1211 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
[1.x Bug] run-operation --sql reports success but rolls back writes on transaction-capable adaptersAbertatriage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
dbt-labs/dbt#16784 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
bug needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 1 dia
-
bug settings ui
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
DewaldOosthuizen/py-tray-command-launcher#162 ·
Mantenedores costumam responder em até 1 dia
-
run_all sleeps after the final job despite documenting delays between jobsTalvez já em andamento @Gambit-Checkmate assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100