Skip to content

Commit

Permalink
docs: clarify getToken + secret in example
Browse files Browse the repository at this point in the history
ref #4954
  • Loading branch information
balazsorban44 committed Jul 17, 2022
1 parent f62a985 commit 5a8b029
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/dev/pages/api/examples/jwt.js
Expand Up @@ -2,6 +2,6 @@
import { getToken } from "next-auth/jwt"

export default async (req, res) => {
const token = await getToken({ req, secret: process.env.SECRET })
const token = await getToken({ req })
res.send(JSON.stringify(token, null, 2))
}
6 changes: 3 additions & 3 deletions apps/example-nextjs/pages/api/examples/jwt.ts
Expand Up @@ -3,12 +3,12 @@ import { getToken } from "next-auth/jwt"

import type { NextApiRequest, NextApiResponse } from "next"

const secret = process.env.NEXTAUTH_SECRET

export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
const token = await getToken({ req, secret })
// If you don't have the NEXTAUTH_SECRET environment variable set,
// you will have to pass your secret as `secret` to `getToken`
const token = await getToken({ req })
res.send(JSON.stringify(token, null, 2))
}

0 comments on commit 5a8b029

Please sign in to comment.