-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth.config.ts
38 lines (36 loc) · 949 Bytes
/
auth.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import Google from 'next-auth/providers/google';
import type { Provider } from 'next-auth/providers';
import type { NextAuthConfig } from 'next-auth';
export type {
Account,
DefaultSession,
Profile,
Session,
User,
} from '@auth/core/types';
const providers: Provider[] = [Google];
export default {
debug: process.env.NODE_ENV !== 'production' ? true : false,
theme: {
colorScheme: 'light',
brandColor: '#18181b',
logo: '/next.svg',
},
providers: providers,
callbacks: {
session: ({ session, token }) => ({
...session,
user: {
...session.user,
id: token.sub,
},
}),
signIn({ user, account, profile }) {
// TOOD: replace to restrict access to only certain emails
const allowedEmails = ['[email protected]'];
return Promise.resolve(
(profile?.email && allowedEmails.includes(profile?.email)) || false
);
},
},
} satisfies NextAuthConfig;