Update auth.py
Browse files
auth.py
CHANGED
@@ -33,6 +33,8 @@ def verify_token(token: str = Depends(oauth2_scheme)):
|
|
33 |
try:
|
34 |
payload = jwt.decode(token, auth_views.SECRET_KEY, algorithms=[auth_views.ALGORITHM])
|
35 |
return payload.get("sub")
|
|
|
|
|
36 |
except jwt.PyJWTError:
|
37 |
raise HTTPException(
|
38 |
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
|
33 |
try:
|
34 |
payload = jwt.decode(token, auth_views.SECRET_KEY, algorithms=[auth_views.ALGORITHM])
|
35 |
return payload.get("sub")
|
36 |
+
except jwt.ExpiredSignatureError:
|
37 |
+
raise HTTPException(status_code=401, detail="Token has expired")
|
38 |
except jwt.PyJWTError:
|
39 |
raise HTTPException(
|
40 |
status_code=status.HTTP_401_UNAUTHORIZED,
|