mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
* docs: add Gatsby example, move Next.js example * chore: fix sync action * docs(example): fix README link
11 lines
381 B
TypeScript
11 lines
381 B
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
|
|
|
|
export default async (req: NextApiRequest, res: NextApiResponse) => {
|
|
const token = await getToken({ req, secret })
|
|
res.send(JSON.stringify(token, null, 2))
|
|
}
|