Problem Statement
What is a key security point about JSON Web Tokens used for APIs?
Explanation
A J W S (signed token) lets receivers verify that claims were not altered. A J W E (encrypted token) protects claim contents in transit. Many breaches stem from poor token handling rather than the format itself, so follow best practices for storage and lifetime.
Code Solution
SolutionRead Only
Header: { alg: RS256, typ: JWT }
Payload: { sub: "123", scope: "read" }
Signature: RSASSA-PKCS1-v1_5 over header.payload