diff --git a/fastapi_microsoft_identity/auth_service.py b/fastapi_microsoft_identity/auth_service.py index d9c024e..5832135 100644 --- a/fastapi_microsoft_identity/auth_service.py +++ b/fastapi_microsoft_identity/auth_service.py @@ -117,7 +117,7 @@ async def decorated(*args, **kwargs): __decode_JWT(token_version, token, rsa_key) return await f(*args, **kwargs) except AuthError as auth_err: - fastapi.Response(content=auth_err.error_msg, status_code=auth_err.status_code) + return fastapi.Response(content=auth_err.error_msg, status_code=auth_err.status_code) return fastapi.Response(content="Invalid header error: Unable to find appropriate key", status_code=401) return decorated @@ -153,7 +153,7 @@ async def decorated(*args, **kwargs): __decode_B2C_JWT(token_version, token, rsa_key) return await f(*args, **kwargs) except AuthError as auth_err: - fastapi.Response(content=auth_err.error_msg, status_code=auth_err.status_code) + return fastapi.Response(content=auth_err.error_msg, status_code=auth_err.status_code) return fastapi.Response(content="Invalid header error: Unable to find appropriate key", status_code=401) return decorated