From 62db3d05223ee594423837b3d3b1ebb8af22687a Mon Sep 17 00:00:00 2001 From: Joe Gasewicz Date: Mon, 14 Dec 2020 15:10:55 +0000 Subject: [PATCH] return 401 status is oauth returns none Fixes #177 (#178) --- flask_jwt_router/_routing.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flask_jwt_router/_routing.py b/flask_jwt_router/_routing.py index 173fdc2..c203e64 100644 --- a/flask_jwt_router/_routing.py +++ b/flask_jwt_router/_routing.py @@ -189,6 +189,9 @@ def _handle_token(self): return abort(401) except AttributeError: return abort(401) + except TypeError: + # This is raised from auth_results["email"] not present + abort(401) else: # Sometimes a developer may define the auth field name as Bearer or Basic auth_header = request.headers.get("Authorization")