next-auth with app router
Unanswered
Holland Lop posted this in #help-forum
Holland LopOP
Hello!
i'm facing some challenges implementing
My site uses app router and i have the
What i've tried to do:
add the attached code to the
and tweaked the
i'm facing some challenges implementing
next-auth to handle communication com my backend and access to specific pages / site header conditional rendering related to the route accessed and active session.My site uses app router and i have the
app/api.ts to handle methods related to my backend routes, app/middleware.ts , and i also have the api/{route}/route.ts for each route that needs calling the backend. What i've tried to do:
add the attached code to the
app/api/auth/[...nextauth]/route.ts and tweaked the
app/api.ts like the attached file. I'm facing receiving errors when trying to run the code. It runs but when i log in i get the error below and i can't use session. What am i missing? GET /api/auth/session 200 in 346ms
[next-auth][error][JWT_SESSION_ERROR]
https://next-auth.js.org/errors#jwt_session_error Invalid Compact JWE {
message: 'Invalid Compact JWE',
stack: 'JWEInvalid: Invalid Compact JWE\n'