jsonwebtoken: 'JsonWebTokenError: jwt malformed'
@devsingh05▲ 13 net votes
Usually the token string passed to jwt.verify still has the 'Bearer ' prefix, or it is literally 'undefined' or 'null' because the client stored nothing. Parse the header: const token = req.headers.authorization?.split(' ')[1]. 'invalid signature' means the signing and verifying secrets differ (check both services load the same env var); 'jwt expired' is TokenExpiredError and should map to 401 so the client refreshes.