From e099ffc40049ef7a964bcc907208a29af640dc84 Mon Sep 17 00:00:00 2001 From: Stefan van der Weide Date: Mon, 5 Jul 2021 23:26:34 +0200 Subject: [PATCH] Added async support to jwt_required view decorator (#436) --- flask_jwt_extended/view_decorators.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flask_jwt_extended/view_decorators.py b/flask_jwt_extended/view_decorators.py index ee5e3041..9a267146 100644 --- a/flask_jwt_extended/view_decorators.py +++ b/flask_jwt_extended/view_decorators.py @@ -4,6 +4,7 @@ from re import split from flask import _request_ctx_stack +from flask import current_app from flask import request from werkzeug.exceptions import BadRequest @@ -118,7 +119,7 @@ def wrapper(fn): @wraps(fn) def decorator(*args, **kwargs): verify_jwt_in_request(optional, fresh, refresh, locations) - return fn(*args, **kwargs) + return current_app.ensure_sync(fn)(*args, **kwargs) return decorator