Function createAuthJsAdapter

  • An Auth.js database adapter that keeps users, accounts, sessions and verification tokens in db, on PostgreSQL or SQLite. Create the tables first with ensureAuthJsTables (or authJsTablesSql in a migration).

    Parameters

    Returns AuthJsAdapter

    import NextAuth from 'next-auth';
    import { createDatabase } from '@framers/sql-storage-adapter';
    import { createAuthJsAdapter, ensureAuthJsTables } from '@framers/sql-storage-adapter/authjs';

    const db = await createDatabase({ url: process.env.DATABASE_URL, strict: true });
    await ensureAuthJsTables(db);
    export const { handlers, auth } = NextAuth({ adapter: createAuthJsAdapter(db), providers: [] });