Open varghesetony901 opened 4 months ago
newRefreshToken hi toh btaya hai bhai. check again
Error : JWT is malformed, when hitting the /refresh-token end point.
To resolve this change the code like this. const { accessToken, refreshToken } = await generateAccessAndRefereshTokens(user._id);
instead of const { accessToken, newRefreshToken } = await generateAccessAndRefereshTokens(user._id);
Do this instead
For those who are getting errors on the basis of jwt malformed do this,
Go to user.models.js Inside the file navigate to where you are generating your access and refresh tokens. Then simply inside it you have this jwt.sign( { } ) But you aren't returning it so it causes you the error.
Fix: return jwt.sign({}) In both access and refresh token generating.
Error : JWT is malformed, when hitting the /refresh-token end point.
To resolve this change the code like this. const { accessToken, refreshToken } = await generateAccessAndRefereshTokens(user._id);
instead of const { accessToken, newRefreshToken } = await generateAccessAndRefereshTokens(user._id);