{% extends "base.html" %} {% block title %}Hooks · Cross-Auth FastAPI Hybrid Example{% endblock %} {% block content %}
The FastAPI example uses hooks to normalize local password login, audit successful lifecycle steps, add a response header after session creation, require verified provider email on OAuth callback, and record SPA token exchanges.
before:authenticate trims and lowercases the email before password verification.after:authenticate records whether password authentication succeeded.after:login records session creation and adds X-Cross-Auth-Hook: login.after:logout records the cleared session ID.before:oauth.callback blocks OAuth users with unverified provider email.after:oauth.callback records social session and SPA authorization callbacks.after:token.authorization_code records SPA token exchanges.{{ event.time }}
{{ event.name }}
{% for key, value in event.items() %}
{% if key not in ["time", "name"] and value %}
· {{ key }}={{ value }}
{% endif %}
{% endfor %}