Next.js Discord

Discord Forum

Jwt Refresh token implementation in nextjs using custom auth

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
Guy i am trying to build a refresh token in nextjs 14 , I am stuck on use case as i am calling a method inside middleware that verify the token on each request this token has payload like user email, user id, that is being used in accessing different resouces based on role authorization . so when the access token is expired the. Request that comes now went into verify refersh token , now in refersh token if valid , i am creating a new access token but i am confused now , as how can i replace the cookies with refersh token as it should be response but then what about the request and it just a mess for me to understand anyway who knows a better approach for authorised where refersh token can also be implemented easily

0 Replies