JSON Web Token
What Is a JWT Token?
A JSON Web Token, or JWT, is a compact signed credential that lets software share verified identity and permission claims. It is commonly used to authenticate API requests and decide what a user may access.
How JSON Web Tokens Work
JWT authentication typically follows this flow.
- A user signs in and the server checks their credentials.
- The server issues a signed token with an expiry and intended audience.
- The app sends it with later API requests.
- The API verifies the signature, issuer, audience, and expiry.
- The API authorizes the requested action from valid claims.
JWT Structure: Header, Payload, and Signature
A JWT has three Base64Url-encoded, dot-separated parts: header, payload, and signature. The payload can include subject, issuer, audience, and expiry claims. Decoding a JWT only makes its contents readable. It does not prove the token is valid or trustworthy.
Signed JWTs vs Encrypted Tokens
Base64Url encoding is not encryption.
| Type | What it protects | Typical use |
|---|---|---|
| Signed JWT | Integrity | API access tokens |
| Encrypted JWT | Integrity and confidentiality | Sensitive token claims |
Benefits of JWT Authentication
JWTs work well across APIs and services.
- Compact credentials for HTTP requests.
- Standards-based claims that multiple services can verify.
- No central session lookup is required for each request.
Practical Limits and Security Risks
A signed token is secure only when applications validate it correctly.
- Stolen tokens can be used until they expire.
- Use short expirations, key rotation, and strict issuer and audience checks.
- Do not put secrets or frequently changing permissions in payloads.
Using JWTs in Applications Built with Emergent
Emergent can help build full-stack apps with login flows, protected APIs, and authorization checks. When planning an AI-built website or a web application, specify who can access each feature and how tokens must be validated.
on Emergent today

