Stage:
Beta
Available on self-hosted:
Yes
Auth Hooks are customizable serverless functions that run at specific points in the authentication lifecycle. Implement as Postgres functions or HTTP webhooks to add custom logic to authentication flows.
Key benefits
- Custom JWT claims: Add roles, permissions, or metadata to access tokens.
- Custom SMS provider: Integrate your preferred SMS service.
- Custom email sending: Use external email services for auth emails.
- Custom MFA verification: Implement custom multi-factor authentication flows.
- Business logic integration: Add custom validation or processing to auth events.
Hook types
Custom Access Token Hook modifies JWT claims before issuance. Send SMS Hook customizes SMS sending. Send Email Hook customizes email sending. MFA Verification Hook adds custom MFA verification logic.
Auth Hooks are valuable for:
- Adding custom claims for authorization
- Integrating custom communication providers
- Implementing custom MFA flows
- Adding business logic to authentication
- Customizing auth emails and SMS messages
Auth Hooks provide the flexibility to customize authentication while leveraging Supabase Auth's foundation.