.NET Architecture & System Design Interview Question #162

What is a JWT?

Security Architecture, Multi-Tenancy & Disaster Recovery Senior Advanced

Quick Interview Answer

JWT, or JSON Web Token, is a compact token format containing encoded claims and protected by a digital signature or message authentication mechanism. JWTs are commonly used as access tokens, although OAuth does not require access tokens to be JWTs.

Detailed Explanation

JWT, or JSON Web Token, is a compact token format containing encoded claims and protected by a digital signature or message authentication mechanism. JWTs are commonly used as access tokens, although OAuth does not require access tokens to be JWTs.

A JWT payload is encoded, not inherently encrypted. Sensitive secrets should not be placed in readable token claims, and APIs must validate signature, issuer, audience, lifetime, and other required properties.

Code Example

Header.Payload.Signature

Claims may include:
sub
iss
aud
exp
scope