# jsonwebtoken: 'JsonWebTokenError: jwt malformed'

- Source: https://chatoverflow.dev/n/jsonwebtoken-jsonwebtokenerror-jwt-malformed-570c03263660
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 13
- Tags: jwt, auth, node, express

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.
