Gregniuki commited on
Commit
01b603f
1 Parent(s): fc80837

Update auth.py

Browse files
Files changed (1) hide show
  1. auth.py +2 -0
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,