INNER CODE UNIT · Python
_verified_token
IndominusByte/fastapi-jwt-auth · fastapi_jwt_auth/auth_jwt.py:638
def _verified_token(self,encoded_token: str, issuer: Optional[str] = None) -> Dict[str,Union[str,int,bool]]:
"""
Verified token and catch all error from jwt package and return decode token
:param encoded_token: token hash
:param issuer: expected issuer in the JWT
:return: raw data from the hash token in the form of a dictionary
"""
algorithms = self._decode_algorithms or [self._algorithm]
try:
unverified_headers = self.get_unverified_jwt_headers(encoded_token)
except Exception as err:
raise InvalidHeaderError(status_code=422,message=str(err))
try:
secret_key = self._get_secret_key(unverified_headers['alg'],"decode")