python-keycloak icon indicating copy to clipboard operation
python-keycloak copied to clipboard

Token session expired

Open huyenntn opened this issue 4 years ago • 2 comments
trafficstars

My script use KeycloakAdmin. After it run 30 minutes, the script occurs an error as bellow:

File "/sa/python_root/python3_django196/lib/python3.5/site-packages/keycloak/exceptions.py", line 108, in raise_error_from_response response_body=response.content) keycloak.exceptions.KeycloakAuthenticationError: 401: b'{"error":"HTTP 401 Unauthorized"}'

Seem as, the Keycloak token has expired. How can I resolved it?

huyenntn avatar Jul 29 '21 06:07 huyenntn

Sounds like the session timed out. Using keycloak_admin.refresh_token() should help (before the timeout)...

double-a avatar Jul 29 '21 18:07 double-a

possible duplicate of #36

gt-novelt avatar Jan 05 '22 13:01 gt-novelt