From 8ac8d313527d950dcbd60f39da9edef941d0de8a Mon Sep 17 00:00:00 2001 From: Daniele Date: Thu, 18 May 2023 14:44:36 +0200 Subject: [PATCH] Fixed decorators' return in case of AuthError --- fastapi_microsoft_identity/auth_service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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