chai-backend
chai-backend copied to clipboard
"Undefined accessToken in /refresh-token API while Destructuring (Variable Name Mismatch)"
write refreshToken: just before newRefreshToken everything will be fine
or use
const {refreshToken,accessToken} = await generateAccessAndRefreshToken refreshToken = new refreshtoken
or use
const {refreshToken,accessToken} = await generateAccessAndRefreshToken refreshToken = new refreshtoken
how will this work @Luckily45
@oiabhishekk simple logic bro when you generating the tokens you them named as access and refresh and when you destructuring the token you named as new refresh that's the problem there either you change the name while generating or change them when you want to use like my case
This will work- const { accessToken, refreshToken: newRefreshToken } = await generateAccessAndRefreshTokens(user._id);