Polar
Polar integration for Better Auth.
Installation
Simple Polar configuration.
Add Polar sh
lib/auth.ts
import and add the polar plugin to Better Auth.
lib/auth-client.ts
Add the polar client to the Better Auth Client.
Polar integration for Better Auth.
Simple Polar configuration.
pnpm dlx shadcn@latest add @auth-cn/polarAdd Polar sh
import { betterAuth } from "better-auth";
// Import the polar plugin
import { polarPlugin } from "@/lib/polar";
const auth = betterAuth({
// Better Auth config...
// Add the polar plugin
plugins: [polarPlugin],
});
import and add the polar plugin to Better Auth.
import { createAuthClient } from "better-auth/react";
// Import the polar client
import { polarClient } from "@polar-sh/better-auth";
// This is all that is needed
// All Polar plugins, etc. should be attached to the server-side BetterAuth config
export const authClient = createAuthClient({
// auth client config...
plugins: [polarClient()],
});Add the polar client to the Better Auth Client.