They use them to place essential context where the application can read it immediately, without extra backend round trips. That improves perceived speed, reduces frontend re-rendering, and makes it easier to pass role, preference, and organization context through the session itself. The trade-off is discipline about which data belongs in tokens versus backend-only storage.
Why tokens and custom claims are used as a session shortcut
JWT claims and other custom metadata let the application carry the minimum context it needs for immediate decisions, so the UI and backend do not have to fetch the same account, tenant, or preference data on every page load. In practice, that means fewer round trips, less loading-state churn, and a cleaner sign-in experience when the information is stable enough to travel with the session.
The important design judgment is that the token is a delivery vehicle, not a full profile store. Put only the context that must be available quickly and that will not create a correctness problem if it is slightly stale until the next refresh.
Common examples include role labels, tenant or organization identifiers, localization preferences, feature flags, and coarse authorization hints. If the application needs a live entitlement check, a high-value account attribute, or anything that changes frequently, that should usually remain backend-owned and be looked up from authoritative storage instead of embedded in a JWT.
For workload and service-to-service designs, the same logic appears in patterns such as Guide to SPIFFE and SPIRE, where identity-bearing context is made available to consumers in a way that avoids unnecessary state lookups while still keeping trust anchored to the issuing system.
What goes wrong when you put too much in the token
The trade-off is that JWTs are easy to overuse. If teams start stuffing detailed user records, sensitive attributes, or mutable permissions into claims, the session becomes harder to revoke cleanly, harder to keep accurate, and more dangerous if it is exposed through browser storage, logs, or client-side inspection.
Token bloat is another practical problem. Large claims increase request size, slow down every hop that carries the token, and can make debugging and support harder because the application now depends on data that may be cached in multiple places rather than owned in one authoritative system.
When the application treats claims as if they were a live source of truth, stale context can become a business logic bug. A user can be moved to a different organization, have a role removed, or lose access to a feature, yet continue operating under old session context until the token expires or is refreshed.
That is why teams often pair claim-based session context with backend validation for sensitive operations. The token can speed up ordinary navigation, while the backend still rechecks the decision point for actions that affect money, data exposure, administrative access, or irreversible state changes.
How to decide what belongs in claims versus backend storage
A useful rule is to ask whether the data is needed for fast presentation, stable enough to tolerate short-lived staleness, and low enough in sensitivity that exposing it in session context is acceptable. If all three are true, it is a candidate for a claim or custom metadata field. If any one of those is false, keep it server-side.
That decision becomes easier when teams separate display context from authoritative state. Presentation context can live in the session so the app can render immediately. Authoritative state, such as entitlements, compliance flags, billing status, or privileged approvals, should stay in the backend so it can be recomputed, audited, and changed without waiting for token expiry.
For more security-sensitive session design, the same principle appears in Microsoft Azure Key Breach and Dropbox Sign Breach, where trust in token or key material becomes a major issue once the underlying signing or access material is exposed.
Practitioners also use this pattern to keep the frontend simpler. Instead of making every screen coordinate a separate profile call, the application can hydrate from session context and reserve backend lookups for changes, exceptions, and sensitive transitions.
Risk and Threat Considerations
Claim-based session design is efficient, but it can become a control weakness if teams treat the token as a durable record of privilege or if they embed data that should be rapidly revocable. The main risk is stale or overexposed context, where the application keeps trusting information that no longer matches the authoritative backend state.
Failure mechanism: Excessive or mutable claims can outlive the business change they represent, and a compromised or replayed token can continue to carry access-relevant context until expiry or revocation is enforced elsewhere.
Impact: Users may retain outdated access, see data they should no longer reach, or trigger privileged actions based on stale session state. If sensitive attributes are placed in the token, exposure can also widen through client storage, browser tooling, telemetry, and logs.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 address the attack and risk surface, while CIS Controls v8, NIST CSF 2.0 and NIST Zero Trust (SP 800-207) set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| CIS Controls v8 | 6 — Access Control Management | Claims affect session access decisions and privilege scope. |
| Recommendation — Limit session claims to approved access context and enforce backend checks for sensitive decisions. | ||
| NIST CSF 2.0 | PR.AC — Access Control | Session context influences how access is granted and enforced. |
| PR.DS — Data Security | Claims can expose sensitive user context if overstuffed or logged. | |
| Recommendation — Use access-control governance to keep token claims aligned with authoritative entitlements. Classify claim data and keep sensitive attributes out of client-visible session payloads. | ||
| NIST Zero Trust (SP 800-207) | 5.2 — Information Flows and Policy Enforcement | JWT claims often feed policy decisions at request time. |
| Recommendation — Enforce policy at the backend and treat tokens as inputs, not the final authority. | ||
| OWASP Non-Human Identity Top 10 | NHI-01 — Secrets and Credential Exposure | Signed session material and claim-bearing tokens become risky when exposed or overtrusted. |
| Recommendation — Minimise token contents and protect signing and session material from exposure. | ||
Practitioner Guidance
What to verify: Confirm that every claim you add has a clear consumer, a clear refresh rule, and a clear owner. If no downstream decision depends on it during the session, it probably does not belong there.
Decision rule: If the value affects authorization, compliance, or other high-impact decisions, require a backend check at the action point rather than trusting the token alone. If it only improves rendering or navigation, a claim is usually appropriate.
Common mistake: Teams often optimize for convenience and then discover that role changes, org moves, and access removals are not taking effect quickly enough. The safer pattern is to keep claims small, short-lived, and easy to refresh.
Practitioner takeaway: Use JWT claims to speed up session experience, not to replace authoritative state, and draw the line at any data whose staleness, sensitivity, or revocation would create security or correctness risk.
Related resources from NHI Mgmt Group
- How should identity teams use risk data to prioritize cybersecurity initiatives?
- When should organisations use temporary access instead of standing access for sensitive secrets?
- How should organizations implement fine-grained permission control across cloud apps and data stores?
- How should organizations prioritize environments for NHI management?