From what I can tell, you can access the login manager via:

current_app.login_manager

From the example I see in the Flask-Security docs (http://pythonhosted.org/Flask-Security/api.html), it probably responds to the native Flask-Login methods found in that module's docs:

https://flask-login.readthedocs.org/en/latest/#api-documentation

I'm just starting to tinker with Flask-Security myself, and am also annoyed with the lack of examples and documentation, so forgive me if this doesn't help ><

Answer from Chockomonkey on Stack Overflow
🌐
GitHub
github.com › dpgaspar › Flask-AppBuilder › blob › master › flask_appbuilder › security › manager.py
Flask-AppBuilder/flask_appbuilder/security/manager.py at master · dpgaspar/Flask-AppBuilder
Simple and rapid application development framework, built on top of Flask. includes detailed security, auto CRUD generation for your models, google charts and much more. Demo (login with guest/welcome) - http://flaskappbuilder.pythonanywhere.com/ ...
Author   dpgaspar
🌐
Reddit
reddit.com › r/flask › need guidance on a custom security manager.
r/flask on Reddit: Need guidance on a custom security manager.
January 21, 2023 -

I am running into some issues with my deployment. I'll give you some background before I explain what I'm trying to do and what I need guidance on.

I have a Flask/AppBuilder app running in a container. This runs fine and works as expected. I want to run it on AWS Lambda behind an API Gateway. So, instead of making a ton of changes to my code (I would still like to run the container in it's current form in a different environment) I am making use of the lambda-web-adapter. This essentially adds a lambda layer which forwards requests that come in to your application. It actually works, kinda. The issue I have is when servicing a request. The way the web adapter works is it boots the app up when initially deploying the function. Then all subsequent invocations are serviced by the already started app.

The problem I have is with the custom security manager I wrote. This looks for a specific header in the request, but the header isn't there. This is probably due to the mapping between API Gateway and the web adapter. Problem is, the authentication header is not present either. This is weird, since when I use one of the built-in security managers, it uses flask-jwt-extended for authentication (not entirely sure how that works. Guessing that it checks for the "authentication" header in the request?) and flask-jwt-extended can find the authorization header just fine. It can't decode the token, hence my custom security manager, but point is, it can find it, and my manager can't.

I've been trying just about everything, but I can't figure it out. I've tried using before_request, but it doesn't have the auth header either.

So, what I'd like to do now is to simply extend the flask-jwt-extended package and override the method(s) that decode the JWT and log the user in. Is this possible? Can you think of why I am experiencing this issue?

I've tried writing some middleware to log the request on each call with call, but that just resulted in an error saying something to the effect of my trying to access request outside of the application context. I don't know why this is, and from the reading I've done, I'm no nearer to understanding it or solving my issue. I've tried doing "from flask import current_app as app" but that didn't work either.

One other approach I did briefly consider was to write a wrapper method. Basically something that would serve as the entry point to my docker container that could get the "event" info from Lambda, then import the flask application and perform a single request against the app. I couldn't get this to work either since running the app blocks the thread and I cannot perform the request. In some sense this approach feels both good and bad. Good since I won't have to run gunicorn, saving on some resources. Bad because for each function invocation I'd have to boot and configure the app which might take longer and result in slower request handling.

Apologies, I know this was a bit of a brain dump, but I've been struggling with this for more than a week. No, Flask/AppBuilder is not something I'm all too familiar with yet.

Thanks for the help in advance!

🌐
Readthedocs
flask-appbuilder.readthedocs.io › en › latest › _modules › flask_appbuilder › security › manager.html
flask_appbuilder.security.manager — Flask AppBuilder
[docs] class BaseSecurityManager(AbstractSecurityManager): auth_view = None """ The obj instance for authentication view """ user_view = None """ The obj instance for user view """ registeruser_view = None """ The obj instance for registering user view """ lm = None """ Flask-Login LoginManager """ jwt_manager = None """ Flask-JWT-Extended """ oauth = None """ Flask-OAuth """ oauth_remotes = None """ OAuth email whitelists """ oauth_whitelists = {} """ Initialized (remote_app) providers dict {'provider_name', OBJ } """ oauth_tokengetter = _oauth_tokengetter """ OAuth tokengetter function overr
🌐
Readthedocs
flask-appbuilder.readthedocs.io › en › latest › security.html
Security - Flask-AppBuilder - Read the Docs
from flask_appbuilder.security.manager import ( AUTH_DB, AUTH_LDAP, AUTH_OAUTH, AUTH_REMOTE_USER, AUTH_SAML, )
🌐
Readthedocs
flask-security-too.readthedocs.io
Welcome to Flask-Security — Flask-Security 5.8.1 documentation
Flask-Security allows you to quickly add common security mechanisms to your Flask application. They include: Authentication (via session, Basic HTTP, or token) User registration (optional) Role and Permission management ·
🌐
Medium
medium.com › artefact-engineering-and-data-science › how-to-handle-superset-authorization-programmatically-43f19473d57e
How to handle Superset authorization programmatically | by Rida kejji | Artefact Engineering and Data Science | Medium
November 29, 2024 - from superset.security import SupersetSecurityManager from custom_remote_user_view import CustomRemoteUserView class CustomSecurityManager(SupersetSecurityManager): authremoteuserview = CustomRemoteUserView # Set according to your chosen authentication method # Instantiate custom Security Manager CUSTOM_SECURITY_MANAGER = CustomSecurityManager AUTH_TYPE = AUTH_REMOTE_USER # Chosen for compatibility with external SSO and load balancer tools · Step 2: in the custom_remote_user_view.py file we write our logic to login and update the user roles. from flask_appbuilder.security.views import AuthRem
Find elsewhere
🌐
GitHub
github.com › ministryofjustice › fab-oidc
GitHub - ministryofjustice/fab-oidc: Flask-AppBuilder SecurityManager for OpenIDConnect
Wrapper for flask_oidc that exposes a SecurityManager for use with any Flask-AppBuilder app. It will allow your users to login with OpenIDConnect providers such as Auth0, Okta or Google Apps.
Starred by 26 users
Forked by 24 users
Languages   Python 100.0% | Python 100.0%
🌐
Readthedocs
flask-appbuilder.readthedocs.io › en › v4.1.0 › security.html
Security — Flask AppBuilder - Read the Docs
from flask_appbuilder.security.manager import ( AUTH_DB, AUTH_LDAP, AUTH_OAUTH, AUTH_OID, AUTH_REMOTE_USER )
🌐
GitHub
github.com › sasaporta › flask-security-admin-example
GitHub - sasaporta/flask-security-admin-example: Example of combining Flask-Security and Flask-Admin
This example combines Flask-Security and Flask-Admin so that authorized administrators can maintain the lists of users and roles that control access to the app. You could easily generalize this app so that administrators could manage all sorts of database tables, not just users and roles.
Starred by 128 users
Forked by 33 users
Languages   Python 95.1% | HTML 4.9% | Python 95.1% | HTML 4.9%
🌐
GitHub
github.com › pwdel › flasksecurity
GitHub - pwdel/flasksecurity: Playing around with logins, best practices for security, etc. · GitHub
Browsers recognize various response headers in order to control security. We recommend reviewing each of the headers below for use in your application. The Flask-Talisman extension can be used to manage HTTPS and the security headers for you.
Author   pwdel
🌐
PyPI
pypi.org › project › Flask-Security
Flask-Security · PyPI
Quickly add security features to your Flask application.
      » pip install Flask-Security
    
Published   May 21, 2026
Version   5.8.1
🌐
GitHub
github.com › pallets-eco › flask-security
GitHub - pallets-eco/flask-security: Quick and simple security for Flask applications · GitHub
Quick and simple security for Flask applications. Contribute to pallets-eco/flask-security development by creating an account on GitHub.
Starred by 698 users
Forked by 166 users
Languages   Python 95.0% | HTML 4.2% | JavaScript 0.8%
🌐
Readthedocs
flask-security-fork.readthedocs.io
Flask-Security — Flask-Security 2.0.1 documentation
Flask-Security is an opinionated Flask extension which adds basic security and authentication features to your Flask apps quickly and easily. Flask-Social can also be used to add "social" or OAuth login and connection management.
🌐
Reddit
reddit.com › r/flask › flask-login vs. flask-user vs flask-security
r/flask on Reddit: Flask-Login vs. Flask-User vs Flask-Security
May 27, 2019 -

Can someone clarify what's going on between these three extensions?

As I understand it, Flask-Security builds upon Flask-Login by integrating other extensions like passlib, itdangerous, flask-wtf, flask-principal, etc. So Flask-Security trumps Flask-Login in this instance.

Then we have Flask-User, looking at it's github, it also has Flask-Login as a dependency. So this also builds upon Flask-Login.

However, Flask-User had it's last commit 20 days ago, and Flask-Security had it's last commit in October of 2018 and the build is failing. No data for Flask-User status.

The consensus seems to veer towards flask-security. But I'm veering towards Flask-User with the little understanding of the real world differences. I'll be creating all my database records with uuid's as the ID's. What would you guys choose and what are the pros and cons of them? Are there any real alternatives?

🌐
Flask
flask.palletsprojects.com › en › stable › web-security
Security Considerations — Flask Documentation (3.1.x)
Browsers recognize various response headers in order to control security. We recommend reviewing each of the headers below for use in your application. The Flask-Talisman extension can be used to manage HTTPS and the security headers for you.
🌐
Surfsidemedia
surfsidemedia.in › post › securing-your-flask-application
Securing Your Flask Application - Surfside Media
Implement secure user authentication and role-based authorization to control access to specific resources. You can use Flask-Login and Flask-Principal for this purpose. Here's an example: from flask_login import LoginManager, UserMixin app = Flask(__name) login_manager = LoginManager(app) class ...
🌐
Medium
medium.com › @mathur.danduprolu › user-authentication-and-authorization-in-flask-building-secure-login-and-access-control-part-5-7-59679a08cdc3
User Authentication and Authorization in Flask: Building Secure Login and Access Control [Part 5/7] | by Mathur Danduprolu | Medium
November 13, 2024 - These features are foundational for creating protected, data-sensitive applications. Flask-Login is a Flask extension that simplifies user session management, allowing you to implement secure user login and authorization features.
🌐
Corgea
corgea.com › learn › flask-security-best-practices-2025
Flask Security Best Practices 2025 | Corgea
June 1, 2025 - In the next sections, we’ll dive into specific Flask security best practices for 2025 that help mitigate the most common vulnerabilities developers face today. A strong security foundation starts with proper application configuration. Never hard-code sensitive secrets (such as SECRET_KEY, API keys, or database passwords) in your source code. Instead, load them from environment variables or use a secrets management tool.