Skip to content

Commit 098eb33

Browse files
committed
ci: logs
1 parent 7d744c2 commit 098eb33

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/pages/api/auth/[...nextauth].ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
// Imports
22
// ========================================================
33
import type { NextApiRequest, NextApiResponse } from "next";
4-
import NextAuth, { type NextAuthOptions } from "next-auth";
4+
import NextAuth from "next-auth";
5+
import { type NextAuthOptions } from "next-auth";
56
import { authOptions } from "@/server/auth";
67

78
// Auth
89
// ========================================================
9-
const Auth = (req: NextApiRequest, res: NextApiResponse) => {
10+
const Auth = async (req: NextApiRequest, res: NextApiResponse) => {
11+
console.log("In [...nextauth].ts");
12+
1013
const authOpts: NextAuthOptions = authOptions({ req });
1114

15+
if (!Array.isArray(req.query.nextauth)) {
16+
res.status(400).send("Bad request");
17+
return;
18+
}
19+
1220
const isDefaultSigninPage =
13-
req.method === "GET" && req?.query?.nextauth?.includes("signin");
21+
req.method === "GET" && req.query.nextauth?.includes("signin");
1422

1523
// Hide Sign-In with Ethereum from default sign page
1624
if (isDefaultSigninPage) {
1725
// Removes from the authOptions.providers array
1826
authOpts.providers.pop();
1927
}
2028

21-
return NextAuth(req, res, authOpts) as typeof NextAuth;
29+
return (await NextAuth(req, res, authOpts)) as typeof NextAuth;
2230
};
2331

2432
// Exports

0 commit comments

Comments
 (0)