@nadeshikon/plugin-nextjs
Version:
Run Next.js seamlessly on Netlify
13 lines (9 loc) • 411 B
text/typescript
// This is an example of how to read a JSON Web Token from an API route
import { getToken } from "next-auth/jwt"
import type { NextApiRequest, NextApiResponse } from "next"
const secret = process.env.NEXTAUTH_SECRET
const jwt = async (req: NextApiRequest, res: NextApiResponse) => {
const token = await getToken({ req, secret })
res.send(JSON.stringify(token, null, 2))
}
export default jwt;