|
4 | 4 | import uuid |
5 | 5 | from functools import wraps |
6 | 6 |
|
7 | | -from flask import Response, g, redirect, request |
| 7 | +from flask import Response, _request_ctx_stack, redirect, request |
8 | 8 |
|
9 | 9 | from .. import ( |
10 | 10 | COOKIE_DATA_NAME, |
@@ -143,7 +143,7 @@ def decorated(*args, **kwargs): |
143 | 143 | return Response("Access denied", 401) |
144 | 144 |
|
145 | 145 | # Save the claims on the context execute the original API |
146 | | - g.claims = jwt_response |
| 146 | + _request_ctx_stack.top.claims = jwt_response |
147 | 147 | response = f(*args, **kwargs) |
148 | 148 |
|
149 | 149 | if jwt_response.get(COOKIE_DATA_NAME, None): |
@@ -181,7 +181,7 @@ def decorated(*args, **kwargs): |
181 | 181 | return Response("Unauthorized", 401) |
182 | 182 |
|
183 | 183 | # Save the claims on the context execute the original API |
184 | | - g.claims = jwt_response |
| 184 | + _request_ctx_stack.top.claims = jwt_response |
185 | 185 | response = f(*args, **kwargs) |
186 | 186 |
|
187 | 187 | set_cookie_on_response( |
@@ -224,7 +224,7 @@ def decorated(*args, **kwargs): |
224 | 224 | return Response("Unauthorized", 401) |
225 | 225 |
|
226 | 226 | # Save the claims on the context execute the original API |
227 | | - g.claims = jwt_response |
| 227 | + _request_ctx_stack.top.claims = jwt_response |
228 | 228 | response = f(*args, **kwargs) |
229 | 229 |
|
230 | 230 | set_cookie_on_response( |
@@ -267,7 +267,7 @@ def decorated(*args, **kwargs): |
267 | 267 | return Response("Unauthorized", 401) |
268 | 268 |
|
269 | 269 | # Save the claims on the context execute the original API |
270 | | - g.claims = jwt_response |
| 270 | + _request_ctx_stack.top.claims = jwt_response |
271 | 271 | response = f(*args, **kwargs) |
272 | 272 |
|
273 | 273 | set_cookie_on_response( |
@@ -310,7 +310,7 @@ def decorated(*args, **kwargs): |
310 | 310 | return Response("Unauthorized", 401) |
311 | 311 |
|
312 | 312 | # Save the claims on the context execute the original API |
313 | | - g.claims = jwt_response |
| 313 | + _request_ctx_stack.top.claims = jwt_response |
314 | 314 | response = f(*args, **kwargs) |
315 | 315 |
|
316 | 316 | set_cookie_on_response( |
@@ -400,7 +400,7 @@ def decorated(*args, **kwargs): |
400 | 400 | return Response("Unauthorized", 401) |
401 | 401 |
|
402 | 402 | # Save the claims on the context execute the original API |
403 | | - g.claims = jwt_response |
| 403 | + _request_ctx_stack.top.claims = jwt_response |
404 | 404 | response = f(*args, **kwargs) |
405 | 405 |
|
406 | 406 | set_cookie_on_response( |
|
0 commit comments