Skip to content

Commit

Permalink
fix: deleted api auth token
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL committed Apr 16, 2024
1 parent 66aca99 commit e5dc1dd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pages/api/token/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { NextApiRequest, NextApiResponse } from "next";
import { getToken } from "next-auth/jwt";

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req;

const secret = process.env.NEXTAUTH_SECRET;

switch (method) {
case "GET":
const jwt = await getToken({ req, secret, raw: true });
res.status(200).json(jwt);
break;
}
}

0 comments on commit e5dc1dd

Please sign in to comment.