ReferenceError: Headers is not defined #4606
Unanswered
AleksandrukTad
asked this question in
Help
Replies: 3 comments
-
Hi, I had the same problem and I fixed it by adding |
Beta Was this translation helpful? Give feedback.
0 replies
-
Does that mean that I need to I feel that there should be a better way to do this. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Got a solution that seems to be slightly better. you can use the import { decode } from 'next-auth/jwt';
// ...
const jwtPayload = await decode({
token: req.cookies['next-auth.session-token'],
secret: process.env.NEXTAUTH_SECRET,
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey,
I am trying to use next-auth getToken function in my nestJS project. NextJs app is talking to NestJS api, it seems that using getToken in NestJS api is a good way for getting the token. When I try to decode the token I am getting "Headers is not defined issue", any idea how to fix that? If not what is the best way for NextJS (using next-auth) coummunication with api? Whats the best way to decode the tokens?
Beta Was this translation helpful? Give feedback.
All reactions