advancedJWT: Token-Based Authentication

What are the three parts of a JWT, and what is each one for?

Header (metadata: signing algorithm and token type), Payload (the actual claims — subject, roles, issued-at, expiry, custom data), and Signature (a cryptographic signature over the header+payload proving the token hasn't been tampered with). All three are Base64URL-encoded and separated by dots; only the signature provides integrity, not the encoding itself.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Is a JWT payload encrypted? Can anyone read it?← Back to all Spring Security questions