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.

Configuration Options

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 instance
  • useOrg: Set to true if you want to use organizations as Autumn customers instead of individual users

This config is passed to the <AutumnProvider /> component that wraps your Next.js application.

Providers

Better-Auth

For Better Auth integration, first import your auth instance:

import { auth } from "@/lib/auth";

<AutumnProvider
  authPlugin={{
    provider: "better-auth",
    instance: auth, // Your server-side better-auth instance
    useOrg: true, // Set to true if organizations are your customers
  }}
>
  {children}
</AutumnProvider>;

Supabase Auth

<AutumnProvider
  authPlugin={{
    provider: "supabase",
  }}
>
  {children}
</AutumnProvider>

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.

Clerk

<AutumnProvider
  authPlugin={{
    provider: "clerk",
    useOrg: true, // Set to true if organizations are your customers
  }}
>
  {children}
</AutumnProvider>

Make sure you’re using the default variable names in your .env.local file: NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY.