File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
example-nextjs/pages/api/examples Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 2
2
import { getToken } from "next-auth/jwt"
3
3
4
4
export default async ( req , res ) => {
5
- const token = await getToken ( { req, secret : process . env . SECRET } )
5
+ const token = await getToken ( { req } )
6
6
res . send ( JSON . stringify ( token , null , 2 ) )
7
7
}
Original file line number Diff line number Diff line change @@ -3,12 +3,12 @@ import { getToken } from "next-auth/jwt"
3
3
4
4
import type { NextApiRequest , NextApiResponse } from "next"
5
5
6
- const secret = process . env . NEXTAUTH_SECRET
7
-
8
6
export default async function handler (
9
7
req : NextApiRequest ,
10
8
res : NextApiResponse
11
9
) {
12
- const token = await getToken ( { req, secret } )
10
+ // If you don't have the NEXTAUTH_SECRET environment variable set,
11
+ // you will have to pass your secret as `secret` to `getToken`
12
+ const token = await getToken ( { req } )
13
13
res . send ( JSON . stringify ( token , null , 2 ) )
14
14
}
You can’t perform that action at this time.
0 commit comments