-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.ts
More file actions
23 lines (22 loc) · 684 Bytes
/
Copy pathauth.ts
File metadata and controls
23 lines (22 loc) · 684 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import NextAuth from 'next-auth';
import { DrizzleAdapter } from '@auth/drizzle-adapter';
import { authConfig } from './auth.config';
import { db } from '@/lib/db';
import {
users,
accounts,
sessions,
verificationTokens,
} from '@/lib/db/schema';
export const { handlers, auth, signIn, signOut } = NextAuth({
...authConfig,
adapter: DrizzleAdapter(db, {
usersTable: users,
accountsTable: accounts,
sessionsTable: sessions,
verificationTokensTable: verificationTokens,
}),
// JWT sessions keep the proxy middleware edge-compatible while the adapter
// still persists users & accounts to Neon for our foreign keys.
session: { strategy: 'jwt' },
});