Skip to content

Commit b53632d

Browse files
johnscathisisshi
authored andcommitted
fix: handle expired tokens properly
In PR #31, invalid token errors were changed to surface rather than be ignored. However, since expired tokens weren't handled separately, they were inadvertently included and surfaced as errors when that specific case of "invalid" should actually just be treated as unauthorized (i.e., ignored) and redirected to the Console to be replaced / updated.
1 parent 3e8fe39 commit b53632d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

redash/authentication/jwt_auth.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ def verify_jwt_token(
124124
# Any other issue with the token means it has a fundamental issue so
125125
# if we send them to the login page it could cause a redirect loop.
126126
raise
127+
except PyJWTError as e:
128+
logger.error("Rejecting JWT token for key %d: %s", i, e)
129+
continue
127130
except Exception as e:
128131
logger.exception("Error processing JWT token: %s", e)
129132
raise InvalidTokenError("Error processing token") from e

0 commit comments

Comments
 (0)