Skip to content

Commit be83eab

Browse files
committed
- feat: cover jwt expired case
1 parent f54b9ec commit be83eab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

api/authentication/serializers/login.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ def validate(self, data):
5555
)
5656
if not session.token:
5757
raise ValueError
58-
except (ObjectDoesNotExist, ValueError):
58+
59+
jwt.decode(session.token, settings.SECRET_KEY, algorithms=["HS256"])
60+
61+
except (ObjectDoesNotExist, ValueError, jwt.ExpiredSignatureError):
5962
session = ActiveSession.objects.create(
6063
user=user,
6164
token=_generate_jwt_token(user)

0 commit comments

Comments
 (0)