Homeglossary

JSON Web Token

JSON Web Token is a signed, compact token format that lets software systems share verified identity and permission claims. Often called a JWT, it is commonly used for API authentication and authorization. Its readable contents are not automatically secret, so sensitive data should not be placed in the token.

Build secure API-powered apps with Emergent.

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.

  1. A user signs in and the server checks their credentials.
  2. The server issues a signed token with an expiry and intended audience.
  3. The app sends it with later API requests.
  4. The API verifies the signature, issuer, audience, and expiry.
  5. 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.

TypeWhat it protectsTypical use
Signed JWTIntegrityAPI access tokens
Encrypted JWTIntegrity and confidentialitySensitive 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.

Start Building
on Emergent today
Start Building