You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromflaskimportgfromflask.sessionsimportSecureCookieSessionInterfacefromflask_loginimportuser_loaded_from_request@user_loaded_from_request.connectdefuser_loaded_from_request(app, user=None):
g.login_via_request=TrueclassCustomSessionInterface(SecureCookieSessionInterface):
"""Prevent creating session from API requests."""defsave_session(self, *args, **kwargs):
ifg.get('login_via_request'):
returnreturnsuper(CustomSessionInterface, self).save_session(*args,
**kwargs)
app.session_interface=CustomSessionInterface()
@user_loaded_from_request.connectdefuser_loaded_from_request(self, user=None):
g.login_via_request=True
The function user_loaded_from_request makes no sense, it is defined twice but the second time has self as argument instead of app. I don´t know what should be correct because the docs does not provide more information and context about the code.
The text was updated successfully, but these errors were encountered:
Hello, I was reading this part of the docs:
https://flask-login.readthedocs.io/en/latest/#disabling-session-cookie-for-apis
The function
user_loaded_from_request
makes no sense, it is defined twice but the second time has self as argument instead of app. I don´t know what should be correct because the docs does not provide more information and context about the code.The text was updated successfully, but these errors were encountered: