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
I think it is necessary to pass the login_manager to init_app in __init__ otherwise a new login_manager instance will be created in init_app. Which causes @login_required to return 401 instead of redirecting to Google. (Since context processor is assigned to the wrong login_manager instance.)
def __init__(self, app=None, login_manager=None):
if login_manager:
self.login_manager = login_manager
else:
self.login_manager = LoginManager()
if app:
self._app = app
self.init_app(app, login_manager=self.login_manager) # <= pass current login_manager instance
I stumbled onto this as I tried following snippet from the documentation:
I think it is necessary to pass the
login_manager
toinit_app
in__init__
otherwise a newlogin_manager
instance will be created ininit_app
. Which causes@login_required
to return 401 instead of redirecting to Google. (Since context processor is assigned to the wronglogin_manager
instance.)I stumbled onto this as I tried following snippet from the documentation:
The text was updated successfully, but these errors were encountered: