diff --git a/django_keycloak/keycloak.py b/django_keycloak/keycloak.py index 7995406..a8b3376 100644 --- a/django_keycloak/keycloak.py +++ b/django_keycloak/keycloak.py @@ -350,6 +350,8 @@ def _is_client_token_timed_out(self): # Get the public key from the identity provider, i.e., the keycloak server decoded = self._decode_token(self._client_token, self.client_jwt_audience) + if not decoded: + return True exp = datetime.fromtimestamp(decoded["exp"], tz=timezone.utc) iat = datetime.fromtimestamp(decoded["iat"], tz=timezone.utc) now = datetime.now(tz=timezone.utc)