Custom JWT spring security backend with AuthJS
Unanswered
Siamese Crocodile posted this in #help-forum
Siamese CrocodileOP
I've got JWT authentication set up with refresh tokens on my backend, and it's working smoothly in Postman. When I hit the /login endpoint, it returns both an accessToken and a refreshToken in JSON. The accessToken is stored in an HttpOnly cookie named accessToken.
On the frontend, I'm using Next.js with NextAuth.js to handle communication with the backend, and it's mostly working. Here's what I've got:
Backend Setup: /login reliably returns both tokens, with accessToken stored in an HttpOnly cookie.
Frontend with NextAuth.js: NextAuth.js is handling authentication between my Next.js frontend and backend.
Token Management: accessToken lasts about 1 day, refreshToken about 15 days.
Automated Token Refresh: How can I smoothly manage token expiration and renewal in my app? I want to automate accessToken renewal using refreshToken when needed.
On the frontend, I'm using Next.js with NextAuth.js to handle communication with the backend, and it's mostly working. Here's what I've got:
Backend Setup: /login reliably returns both tokens, with accessToken stored in an HttpOnly cookie.
Frontend with NextAuth.js: NextAuth.js is handling authentication between my Next.js frontend and backend.
Token Management: accessToken lasts about 1 day, refreshToken about 15 days.
Automated Token Refresh: How can I smoothly manage token expiration and renewal in my app? I want to automate accessToken renewal using refreshToken when needed.
1 Reply
Siamese CrocodileOP
Also, my backend checks for the accessToken cookie but i noticed auth js creates its own cookies. what do I do in this case?