Automatically create customers in Autumn when a user signs up with our Next.js authentication plugins
Autumn provides authentication plugins that make it easy to integrate with popular auth providers. Instead of manually finding and passing customer IDs, you can use our auth plugins to automatically sync the customer information.
The auth plugin configuration accepts the following fields:
provider
: The authentication provider to use (“better-auth”, “supabase”, or “clerk”)instance
: For better-auth, your server-side auth instanceuseOrg
: Set to true
if you want to use organizations as Autumn customers instead of individual usersThis config is passed to the <AutumnProvider />
component that wraps your Next.js application.
If you’re using an Auth Plugin, then you don’t need to pass the customerId
prop into AutumnProvider, as we’ll get this automatically from the auth
provider.
For Better Auth integration, first import your auth instance:
Supabase does not support organizations, so useOrg
is not supported for
Supabase.
Make sure you’re using the default variable names in your .env.local file:
NEXT_PUBLIC_SUPABASE_URL
and NEXT_PUBLIC_SUPABASE_ANON_KEY
.
Make sure you’re using the default variable names in your .env.local file:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
and CLERK_SECRET_KEY
.