Browse Source
Merge pull request #99 from happy-river/token-not-active
Handle 'Token is not active' error in refresh_token
master
Marcos Pereira
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
1 deletions
-
keycloak/keycloak_admin.py
|
@ -1469,7 +1469,8 @@ class KeycloakAdmin: |
|
|
try: |
|
|
try: |
|
|
self.token = self.keycloak_openid.refresh_token(refresh_token) |
|
|
self.token = self.keycloak_openid.refresh_token(refresh_token) |
|
|
except KeycloakGetError as e: |
|
|
except KeycloakGetError as e: |
|
|
if e.response_code == 400 and b'Refresh token expired' in e.response_body: |
|
|
|
|
|
|
|
|
if e.response_code == 400 and (b'Refresh token expired' in e.response_body or |
|
|
|
|
|
b'Token is not active' in e.response_body): |
|
|
self.get_token() |
|
|
self.get_token() |
|
|
else: |
|
|
else: |
|
|
raise |
|
|
raise |
|
|