Browse Source

Merge pull request #229 from delphai/fix-session-not-active

Handle refresh_token error "Session not active"
pull/245/head^2
Marcos Pereira 3 years ago
committed by GitHub
parent
commit
bf0b3ea4df
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      keycloak/keycloak_admin.py

8
keycloak/keycloak_admin.py

@ -1989,8 +1989,12 @@ class KeycloakAdmin:
try:
self.token = self.keycloak_openid.refresh_token(refresh_token)
except KeycloakGetError as e:
if e.response_code == 400 and (b'Refresh token expired' in e.response_body or
b'Token is not active' in e.response_body):
list_errors = [
b'Refresh token expired',
b'Token is not active',
b'Session not active'
]
if e.response_code == 400 and any(err in e.response_body for err in list_errors):
self.get_token()
else:
raise

Loading…
Cancel
Save