Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ef0df6c

Browse files
chore: clean up NextAuth.js config
1 parent b88eadf commit ef0df6c

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

‎app/api/auth/[...nextauth]/route.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
import NextAuth, { NextAuthOptions } from "next-auth";
1+
import NextAuth, { typeNextAuthOptions } from "next-auth";
22
import CredentialsProvider from "next-auth/providers/credentials";
33
import prisma from "@/lib/prisma";
44
import { compare } from "bcrypt";
55

66
export const authOptions: NextAuthOptions = {
77
providers: [
88
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 ?? {}
1615
if (!email || !password) {
1716
throw new Error("Missing username or password");
1817
}
@@ -29,7 +28,6 @@ export const authOptions: NextAuthOptions = {
2928
},
3029
}),
3130
],
32-
session: { strategy: "jwt" },
3331
};
3432

3533
const handler = NextAuth(authOptions);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /