Skip to content

Integrating with Python Flask API

Terminal window
pip install "authaction-python-sdk[flask]"
from authaction import AuthAction
from authaction.flask import make_require_auth
aa = AuthAction(domain=os.getenv("AUTHACTION_DOMAIN"), audience=os.getenv("AUTHACTION_AUDIENCE"))
require_auth = make_require_auth(aa)
@app.get("/protected")
@require_auth
def protected():
from flask import g
return {"sub": g.current_user["sub"]}

Full SDK reference: github.com/authaction/authaction-python-sdk