@@ -101,6 +101,16 @@ <h1 class="title">Module <code>supertokens_python.framework.flask.flask_middlewa
101
101
102
102
return response_.response
103
103
104
+ @app.teardown_request
105
+ def _(_):
106
+ from flask import g
107
+
108
+ if hasattr(g, "supertokens"):
109
+ # this is to ensure there are no shared objects between requests.
110
+ # calling any other API with a shared request causes a security issue, resulting in unintentional
111
+ # sign-ins. More on this here - https://github.com/supertokens/supertokens-python/issues/463
112
+ g.pop("supertokens")
113
+
104
114
def set_error_handler(self):
105
115
app = self.app
106
116
from supertokens_python.exceptions import SuperTokensError
@@ -203,6 +213,16 @@ <h2 class="section-title" id="header-classes">Classes</h2>
203
213
204
214
return response_.response
205
215
216
+ @app.teardown_request
217
+ def _(_):
218
+ from flask import g
219
+
220
+ if hasattr(g, "supertokens"):
221
+ # this is to ensure there are no shared objects between requests.
222
+ # calling any other API with a shared request causes a security issue, resulting in unintentional
223
+ # sign-ins. More on this here - https://github.com/supertokens/supertokens-python/issues/463
224
+ g.pop("supertokens")
225
+
206
226
def set_error_handler(self):
207
227
app = self.app
208
228
from supertokens_python.exceptions import SuperTokensError
@@ -288,7 +308,17 @@ <h3>Methods</h3>
288
308
if hasattr(g, "supertokens") and g.supertokens is not None:
289
309
manage_session_post_response(g.supertokens, response_, {})
290
310
291
- return response_.response</ code > </ pre >
311
+ return response_.response
312
+
313
+ @app.teardown_request
314
+ def _(_):
315
+ from flask import g
316
+
317
+ if hasattr(g, "supertokens"):
318
+ # this is to ensure there are no shared objects between requests.
319
+ # calling any other API with a shared request causes a security issue, resulting in unintentional
320
+ # sign-ins. More on this here - https://github.com/supertokens/supertokens-python/issues/463
321
+ g.pop("supertokens")</ code > </ pre >
292
322
</ details >
293
323
</ dd >
294
324
< dt id ="supertokens_python.framework.flask.flask_middleware.Middleware.set_error_handler "> < code class ="name flex ">
0 commit comments