forked from Kiranism/next-shadcn-dashboard-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth.config.ts
43 lines (40 loc) · 1.18 KB
/
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
39
40
41
42
43
import { NextAuthConfig } from 'next-auth';
import CredentialProvider from 'next-auth/providers/credentials';
import GithubProvider from 'next-auth/providers/github';
const authConfig = {
providers: [
GithubProvider({
clientId: process.env.GITHUB_ID ?? '',
clientSecret: process.env.GITHUB_SECRET ?? ''
}),
CredentialProvider({
credentials: {
email: {
type: 'email'
},
password: {
type: 'password'
}
},
async authorize(credentials, req) {
const user = {
id: '1',
name: 'John',
email: credentials?.email as string
};
if (user) {
// Any object returned will be saved in `user` property of the JWT
return user;
} else {
// If you return null then an error will be displayed advising the user to check their details.
return null;
// You can also Reject this callback with an Error thus the user will be sent to the error page with the error message as a query parameter
}
}
})
],
pages: {
signIn: '/' //sigin page
}
} satisfies NextAuthConfig;
export default authConfig;