diff --git a/fastapi_jwt_auth/auth_jwt.py b/fastapi_jwt_auth/auth_jwt.py index 4110bdb..0e26fae 100644 --- a/fastapi_jwt_auth/auth_jwt.py +++ b/fastapi_jwt_auth/auth_jwt.py @@ -614,7 +614,7 @@ def _verify_jwt_in_request( issuer = self._decode_issuer if type_token == 'access' else None self._verifying_token(token,issuer) - if self.get_raw_jwt(token)['type'] != type_token: + if 'type' in token and self.get_raw_jwt(token)['type'] != type_token: msg = "Only {} tokens are allowed".format(type_token) if type_token == 'access': raise AccessTokenRequired(status_code=422,message=msg) @@ -632,7 +632,7 @@ def _verifying_token(self,encoded_token: str, issuer: Optional[str] = None) -> N :param issuer: expected issuer in the JWT """ raw_token = self._verified_token(encoded_token,issuer) - if raw_token['type'] in self._denylist_token_checks: + if 'type' in raw_token and raw_token['type'] in self._denylist_token_checks: self._check_token_is_revoked(raw_token) def _verified_token(self,encoded_token: str, issuer: Optional[str] = None) -> Dict[str,Union[str,int,bool]]: