INNER CODE UNIT · Python
_verify_jwt_in_request
IndominusByte/fastapi-jwt-auth · fastapi_jwt_auth/auth_jwt.py:587
def _verify_jwt_in_request(
self,
token: str,
type_token: str,
token_from: str,
fresh: Optional[bool] = False
) -> None:
"""
Ensure that the requester has a valid token. this also check the freshness of the access token
:param token: The encoded JWT
:param type_token: indicate token is access or refresh token
:param token_from: indicate token from headers cookies, websocket
:param fresh: check freshness token if True
"""
if type_token not in ['access','refresh']:
raise ValueError("type_token must be between 'access' or 'refresh'")
if token_from not in ['headers','cookies','websocket']: