Skip to content Skip to sidebar Skip to footer

Flask-Login Shows 401 Instead Of Redirecting To Login View

Using Flask-Login, I want to require login for some views. When I try to access a view that is decorated with @login_required, I get a 401 message instead of the login page. How

Solution 1:

You haven't told Flask-Login what view to use to show the login form, so it defaults to a generic 401 error. From the docs: "If the login view is not set, it will abort with a 401 error."

login_manager.login_view = 'login'

Post a Comment for "Flask-Login Shows 401 Instead Of Redirecting To Login View"