Use with Flask-LoginΒΆ

Use the LoginManager.request_loader to authenticate:

from flask_cfaccess import CfAccess
from flask_login import LoginManager

cfaccess = CfAccess()

login_manager = LoginManager()

@login_manager.request_loader
def request_loader(request):
    identity = cfaccess.get_identity()
    if identity:
        return identity["user_uuid"]

You may substite user_uuid with any of the fields in application token documentation or provided by your individual IdP under the idp key.