File tree 1 file changed +7
-9
lines changed
app/api/auth/[...nextauth]
1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 1
- import NextAuth , { NextAuthOptions } from "next-auth" ;
1
+ import NextAuth , { type NextAuthOptions } from "next-auth" ;
2
2
import CredentialsProvider from "next-auth/providers/credentials" ;
3
3
import prisma from "@/lib/prisma" ;
4
4
import { compare } from "bcrypt" ;
5
5
6
6
export const authOptions : NextAuthOptions = {
7
7
providers : [
8
8
CredentialsProvider ( {
9
- credentials : { } ,
10
- // @ts -ignore
11
- async authorize ( credentials , _ ) {
12
- const { email, password } = credentials as {
13
- email : string ;
14
- password : string ;
15
- } ;
9
+ credentials : {
10
+ email : { label : "Email" , type : "email" } ,
11
+ password : { label : "Password" , type : "password" }
12
+ } ,
13
+ async authorize ( credentials ) {
14
+ const { email, password } = credentials ?? { }
16
15
if ( ! email || ! password ) {
17
16
throw new Error ( "Missing username or password" ) ;
18
17
}
@@ -29,7 +28,6 @@ export const authOptions: NextAuthOptions = {
29
28
} ,
30
29
} ) ,
31
30
] ,
32
- session : { strategy : "jwt" } ,
33
31
} ;
34
32
35
33
const handler = NextAuth ( authOptions ) ;
You can’t perform that action at this time.
0 commit comments