FlowgladServer with the authenticated customer from popular auth providers or from your own session logic. The examples below assume a Next.js project, but the same patterns apply anywhere you can create a FlowgladServer instance.
Flowglad provides adapters for these auth providers:
- Supabase Auth
- Clerk
- NextAuth
- Better Auth
Supabase Auth
Clerk
NextAuth
Better Auth
Custom session loaders
When you already have a helper that returns the signed-in user, pass it throughgetRequestingCustomer.
Custom auth example: Firebase
What happens at runtime?
Each adapter populates the customer payload that Flowglad needs to create purchases, subscriptions, and usage. Returningnull simply means the request is unauthenticated. For edge or serverless environments, make sure the adapter you choose works with the runtime (e.g. Supabase Auth helpers are edge-ready).