-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.ts
More file actions
24 lines (22 loc) · 717 Bytes
/
Copy pathauth.ts
File metadata and controls
24 lines (22 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import NextAuth from "next-auth";
import Credentials from "next-auth/providers/credentials";
export const { handlers, signIn, signOut, auth } = NextAuth({
providers: [
Credentials({
credentials: {
username: { label: "Username", type: "text"},
password: { label: "Password", type: "password" },
},
async authorize(credentials : any): Promise<any> {
const user = { id: 1, name: "admin", password: "password" };
if (credentials.username === user.name && credentials.password === user.password) {
return user;
}
else {
return null;
}
},
}),
],
secret: process.env.AUTH_SECRET,
});