Understand JWT decode vs verify before trusting a token
Decoding a JWT reveals its claims. Checking the signature detects whether a signed token has changed. Reading a user ID from the payload doesn't authenticate the caller.
npm install --save-dev @sitecmd/cli
npx sitecmd audit .
The CLI runs on your computer or in your CI, and your code stays there.
What it finds on a demo project
The CLI flags route code that decodes a JWT with no apparent verification step.
SiteCMD CLI 2.0.0
Demo project: Profile endpoint that decodes a token
npx sitecmd audit .
SiteCMD Code Scan - .
Checked: November 9, 2026
Framework: Express
Issues: 1 total | critical 0 | high 1 | medium 0 | low 0
High (1)
- [Security · security] JWT decode found without recognized local verification - src/profile.js:10
Your code passes? Now watch your site.
Verify a JWT signature with the expected algorithm
Configure the verifier with the algorithms your app accepts and the key source you expect. Don't let an untrusted token choose a different verification method. RFC 8725 explains algorithm verification.
Treat jwt-decode as a reader, not an authentication check
A decoded token can be useful for display. Before using a claim to decide identity or permission, follow the request to the maintained server verifier that decides whether to accept the token.
Check JWT expiry as well as the signature
If a token has an exp claim, don't accept it after that time, apart from a small allowance for clock differences. Apply the issuer and audience rules your app expects too. The JWT standard defines expiration; RFC 8725 covers issuer and audience validation.
Frequently asked questions
Does jwt-decode verify the token?
No. The jwt-decode library only reads a token's contents, and its documentation says it doesn't validate the token.
Decide where verified tokens live and how sign-in returns
Website security
Catch leaked API keys and exposed files before someone uses them against you.
Storing auth tokens: localStorage or cookies
Choose token storage based on script access and requests that carry cookies.
OAuth state and PKCE
Tie each third-party sign-in callback to the browser that started it.