@sharekit/next-auth
v0.2.3
Published
NextAuth.js / Auth.js adapter for the Shareable SDK
Readme
@sharekit/next-auth
NextAuth.js / Auth.js adapter for the Shareable SDK. Supports both NextAuth v4 and v5 (Auth.js).
Installation
pnpm add @sharekit/next-auth @sharekit/core next-authUsage
NextAuth v5 (Auth.js)
import { nextAuthProvider } from "@sharekit/next-auth";
import { auth } from "./auth"; // Your Auth.js config
const shareable = createShareable({
auth: nextAuthProvider({ auth }),
// ...
});NextAuth v4
import { nextAuthProvider } from "@sharekit/next-auth";
import { getServerSession } from "next-auth";
import { authOptions } from "./auth";
const shareable = createShareable({
auth: nextAuthProvider({ getServerSession, authOptions }),
// ...
});Options
auth-- Auth.js v5auth()functiongetServerSession-- NextAuth v4getServerSessionfunctionauthOptions-- NextAuth v4 auth optionsidField-- Which field to use as user ID:"id"(default) or"email"(for providers without a consistent ID)
