Quick revision
The short answer
Access tokens should carry what resource servers need to authorize a request: sub, iss, aud, exp, the scopes or coarse roles, and a tenant id. The full permission list, email, address and balance should stay out: tokens are readable and often logged by mistake, large tokens hit header size limits and add cost to every request, fast-changing permissions are better checked at the service than frozen into a token, and a balance is data, not identity, so it is stale the moment the token is issued.
What to remember
In this answer, we decided what goes into access tokens. They carry what authorization needs: sub, iss, aud, exp, scopes or coarse roles, and the tenant id. Personal data such as email and address stays out because tokens are readable and end up in logs. Full permission lists stay out because they bloat every request toward header limits and freeze permissions until expiry. Balances stay out because they are business data that is stale immediately. Services fetch such data when they need it.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Access tokens should carry what resource servers need to authorize a request: sub, iss, aud, exp, the scopes or coarse roles, and a tenant id. The full permission list, email, address and balance should stay out: tokens are readable and often logged by mistake, large tokens hit header size limits and add cost to every request, fast-changing permissions are better checked at the service than frozen into a token, and a balance is data, not identity, so it is stale the moment the token is issued.
Why this question is asked
It is tempting to treat the access token as a convenient bag for anything a service might want, because then no service needs to look anything up. Interviewers ask this design question because the consequences arrive later: personal data in log files, requests failing with 431 errors, users keeping permissions after they were removed. In this answer, we will recap what an access token is for, decide which claims belong in it, then go through the team's proposed additions one by one, and end with what services should do instead.
1What an Access Token Is For
An access token answers one question for a resource server: should this request be allowed? To answer it, the service needs to know who issued the token, who it is about, whether it is meant for this service, whether it is still valid, and what the caller is permitted to do in broad terms. Everything beyond that is data the service could fetch itself.
Two facts about JWT access tokens shape the rest of the decision. First, a signed JWT is readable by anyone who holds it, because the payload is only encoded. Second, the token travels with every request, often through browsers, gateways, proxies and logs, and lives until it expires.
2The Claims That Belong in the Token
We include the registered claims sub, iss, aud and exp, plus iat and jti if useful. sub identifies the user with a stable id, ideally an opaque one such as a UUID rather than an email, which can change and is personal data. iss and aud let the service check the token came from our provider and was meant for it. exp limits its life.
For authorization we add scopes, for example orders.read, and at most a few coarse roles such as admin or support, which change rarely. In a multi-tenant system we add the tenant id, because almost every authorization decision depends on it and it does not change during a session.
| Proposed claim | Decision | Reason |
|---|---|---|
| sub, iss, aud, exp | include | needed to validate any token |
| scopes, coarse roles | include | drive authorization, change rarely |
| tenant id | include | used in almost every decision |
| full permission list | leave out | large, changes often, stale until expiry |
| email, address | leave out | personal data in a readable, logged token |
| account balance | leave out | business data, stale at once |
3Why Personal Data Stays Out
Email and postal address are personal data under laws such as GDPR. A token containing them is readable by any component that sees it, and tokens end up in places nobody intended: HTTP access logs that record headers, browser developer tools, error reports pasted into tickets, and tracing systems. Each of those then holds personal data that must be protected, retained and deleted according to policy, which nobody planned for. If a service needs the user's email to send a receipt, it can call a user service, or use the OpenID Connect user info endpoint, at the moment it needs it.
4Why Size and Permission Lists Matter
Every byte of the token goes on every request. A full permission list for a power user can easily be hundreds of entries; at 30 bytes each, 300 permissions make 9 KB of JSON, about 12 KB once base64url encoded and signed. Many servers and proxies limit request headers to 8 KB or 16 KB in total, so such a user's requests fail with 431 or 400 errors while everyone else's work, a confusing bug. Even below the limit, larger tokens cost bandwidth and parsing time on every hop.
The bigger problem is staleness. A token freezes the permissions at the moment it was issued. If an administrator removes a permission at 10:00 and the token expires at 10:15, the user keeps it for 15 minutes. For permissions that change often or matter a lot, the service should check them where the data lives, for example with a fast permission service or a local cache keyed by user and tenant, and use the token only to know who is asking.
5Why a Balance Does Not Belong
An account balance is not identity or authorization at all. It is business data that changes with every transaction. A token issued at 9:00 with a balance of 500 still says 500 at 9:10 after the user spent 200, so any service that trusts it makes wrong decisions. The account service is the only source of truth for the balance, and services should ask it. A useful rule for the team: if a value would be wrong after the user does something in the app, it does not belong in a token.
6Follow-up questions
Isn't looking things up slower than reading them from the token?
A little, but it is usually a cached call of a few milliseconds, made only by the services that need the data. The alternative makes every request to every service carry the data, and makes some decisions wrong for the token's lifetime.
What about fine-grained permissions in one service?
That service can map the user and tenant to permissions itself, using its own data or a policy engine. The token carries the stable identity and coarse scopes; the fine detail stays close to the resources it protects.
Could we encrypt the token with JWE so personal data is safe?
Encryption hides the content from intermediaries, but the data is still copied into every request, still stale, and still needs key management at every service. Leaving it out is simpler and safer.
7Conclusion
In this answer, we decided what goes into access tokens. They carry what authorization needs: sub, iss, aud, exp, scopes or coarse roles, and the tenant id. Personal data such as email and address stays out because tokens are readable and end up in logs. Full permission lists stay out because they bloat every request toward header limits and freeze permissions until expiry. Balances stay out because they are business data that is stale immediately. Services fetch such data when they need it.
Open with
I would keep access tokens to what a resource server needs for authorization. That means the standard claims sub, iss, aud and exp, with sub being a stable opaque id rather than an email; the scopes, maybe a few coarse roles that rarely change; and the tenant id in a multi-tenant system, because nearly every decision depends on it.
Then, if they want more
Then I would push back on each addition. Email and address are personal data, and a signed JWT is readable by anyone who holds it; tokens end up in access logs, traces and tickets, so we would be spreading personal data everywhere. Services that need the email can fetch it from the user service or the user info endpoint.
The full permission list makes tokens large: a few hundred permissions can push the token past the 8 or 16 kilobyte header limits of proxies, so some users would get 431 errors, and every request carries the cost.
It is also frozen until the token expires, so a removed permission keeps working for the token's lifetime; those checks belong in the service or a permission service. The balance is not identity at all: it is business data that is wrong the moment the user makes a transaction, and only the account service should answer it.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- RFC 7519, JSON Web Token
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "What claims would you put in access tokens for your APIs, and what would you keep out? A...": https://scrivio-interview-library.netlify.app/spring-boot/jwt/1738768933/