Skip to content

Commit 8ddcde7

Browse files
committed
jwt token: add required claims
1 parent bcad9b0 commit 8ddcde7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

backend/btrixcloud/auth.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,13 @@ def generate_jwt(data: dict, minutes: int) -> str:
112112
# ============================================================================
113113
def decode_jwt(token: str, audience: Optional[List[str]] = None) -> dict:
114114
"""decode JWT token"""
115-
return jwt.decode(token, PASSWORD_SECRET, algorithms=[ALGORITHM], audience=audience)
115+
return jwt.decode(
116+
token,
117+
PASSWORD_SECRET,
118+
algorithms=[ALGORITHM],
119+
options={"require": ["exp", "aud", "sub"]},
120+
audience=audience,
121+
)
116122

117123

118124
# ============================================================================

0 commit comments

Comments
 (0)