Scrivio Interview library
LeadershipPrincipal5 min read · updated 12 November 2026

Your platform passes user identity between dozens of internal services and several partner companies using JWTs. Looking ahead several years, how would you design identity propagation so trust stays explicit as the number of parties grows?

I would stop forwarding one broad token everywhere and instead issue an audience-restricted token for each hop with OAuth 2.0 Token Exchange (RFC 8693), so each service receives a token meant only for it. Partners receive tokens issued for them with limited scopes and never see internal tokens, delegation chains are recorded in actor claims so audits show who acted for whom, and the trust relationships themselves, issuers and audiences, live in a managed registry with owners and are reviewed regularly.

Why this question is asked

Identity propagation starts simply: the gateway receives a user's token and every service passes it along. That works for five services. With dozens of services and several partner companies, the same token is now a key that opens everything, held by every component on every path, and nobody can say exactly who trusts whom. Interviewers ask this to see whether a senior engineer can design trust that stays explicit as the system grows. In this answer, we will look at why forwarding one token breaks down, design per-hop tokens with token exchange, handle partners, record delegation for audit, and manage the trust relationships over time.

1Why Forwarding One Token Breaks Down

Imagine a user's access token with a broad audience, valid for 15 minutes. The gateway passes it to the orders service, which passes it to pricing, which passes it to a partner's shipping API. Every one of those components now holds a token that would be accepted by all the others. If any one is compromised, or simply logs headers, the attacker can call every service as that user. And when the partner receives the token, our internal credential has left the company.

There is also an audit problem. When the payments service sees a request, the token says only that user-42 is calling. It cannot tell whether the user clicked a button or a batch job in another service acted on the user's behalf, so the audit log cannot answer who actually did it.

2Per-Hop Tokens With Token Exchange

Token exchange, RFC 8693, lets a service trade the token it received for a new one meant for its next call. The orders service sends the incoming token as the subject_token to the identity provider's token endpoint, authenticates as itself, and asks for a token with audience pricing-api and only the scopes pricing needs. The provider checks a policy, may orders call pricing on behalf of users, and returns a narrow, short-lived token.

Java
POST /oauth2/token
Authorization: Basic b3JkZXJzLXNlcnZpY2U6... # orders-service authenticates as itself
grant_type=urn:ietf:params:oauth:grant-type:token-exchange
&subject_token=eyJ...user-token...
&subject_token_type=urn:ietf:params:oauth:token-type:access_token
&audience=pricing-api
&scope=prices.read
// returned token payload
{"iss":"https://login.example.com","sub":"user-42","aud":"pricing-api","scope":"prices.read",
"act":{"sub":"orders-service"},"exp":1762430100}
Step throughIdentity across three hops with token exchange
GatewayOrders serviceIdentity providerPricing servicePartner API
user token, aud orders-api
exchange for aud pricing-api
token: sub user-42, act orders
call with pricing token
exchange for partner audience
partner token, limited scope
call with partner-issued token

7 messages in order. Play them, or step through them one at a time.

Each hop receives a token valid only for itself; no component holds a key to everything.

3What Partners Receive

A partner must never receive one of our internal tokens. When a call leaves the company, the token is issued for that partner: its audience is the partner's API, its scopes are only those in our agreement with them, its lifetime is short, and its subject may be a pseudonymous id rather than our internal user id. Often the partner runs its own authorization server, and we obtain the token from it with client credentials or a JWT bearer assertion that it trusts.

The rule protects both sides. If the partner's systems leak tokens, the damage is limited to what we agreed to share with that partner, and our internal APIs reject those tokens because the audience and possibly the issuer do not match.

4Recording the Delegation Chain

The act claim in the exchanged token says which party is acting on behalf of the subject. When pricing exchanges the token again, the provider nests the previous actor, so the token reads like a chain: user-42, through orders-service, through pricing-service. The final service writes that chain into its audit log.

That gives audit a precise answer. A support agent acting for a customer, a batch job acting for many users and a user acting directly all look different. It also enables policy: payments may accept a request from a user directly or through checkout, but refuse one that arrives through a reporting service, even with the same user.

5Managing Trust as the Number of Parties Grows

The rules above only stay explicit if the trust relationships are data with owners. We keep a registry, in the identity provider's configuration managed as code, that lists every issuer we trust, every audience, which services may exchange tokens for which audiences, and which partners receive which scopes. Each entry has an owning team and a review date. Adding a partner or a new service hop is a reviewed change to that registry, not a quiet configuration change in one service.

Then we review it on a schedule, for example every six months and whenever a partner joins or leaves. Unused exchange permissions are removed, departed partners' clients are revoked, and audiences of retired services are deleted. Over several years this review is what prevents the slow return to everyone trusting everyone.

Step throughLayers of explicit trust
  1. Registry with ownersissuers, audiences, exchange policies, partner scopes
  2. Identity providerenforces exchange policy, issues per-hop tokens
  3. Servicesvalidate iss, aud, scope; log the act chain
  4. Partnersreceive only partner-issued, limited tokens

4 layers, from the top down. Step through them one at a time.

6Follow-up questions

Doesn't token exchange add latency to every call?

It adds one call per hop, but exchanged tokens can be cached by the calling service for their short lifetime, keyed by the incoming token and target audience. For most paths, the cost is a few milliseconds on the first call and nothing after that.

Could a service mesh with mutual TLS replace this?

Mutual TLS proves which service is calling, which is valuable, but it says nothing about which user the call is for or what that user allowed. The two complement each other: mTLS for the workload identity, exchanged tokens for the user and the delegation.

How do you migrate from forwarding tokens to exchange?

Start at the boundaries that matter most, partner calls and high-value services such as payments, by making them require their own audience. Then services calling them adopt exchange through the shared client library, and the broad token's audience shrinks step by step.

7Conclusion

In this answer, we designed identity propagation that stays explicit. Instead of forwarding one broad token, each hop obtains an audience-restricted token through token exchange, RFC 8693. Partners receive only tokens issued for them with limited scopes. Actor claims record the delegation chain so audits show who acted for whom, and every issuer, audience and exchange permission lives in a managed registry with owners and regular reviews.

What to say in the interviewAbout 80 seconds aloud

Open with

Looking ahead, the main thing I would change is to stop forwarding the same broad token through every service, because then every component holds a credential that works everywhere, and a single leak or log line exposes the whole platform.

Then, if they want more

Instead, each hop gets its own token. With OAuth 2.0 Token Exchange, RFC 8693, a service sends the token it received as the subject token, authenticates as itself, and asks the identity provider for a token with the audience and scopes of its next call only.

The provider checks a policy of which services may call which on behalf of users. Partners never receive internal tokens: calls leaving the company use tokens issued for that partner, with the scopes in our agreement, short lifetimes and possibly pseudonymous subjects.

Exchanged tokens carry an act claim, nested at each hop, so the final service can log that user-42 acted through orders and pricing, and policy can distinguish a user acting directly from a batch job acting for them.

Finally, I keep the trust relationships, trusted issuers, audiences, exchange permissions and partner scopes, in a registry managed as code with an owner per entry, and review it every six months and whenever a partner joins or leaves, so trust stays explicit as parties are added.

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 "Your platform passes user identity between dozens of internal services and several...": https://scrivio-interview-library.netlify.app/spring-boot/jwt/814d92591f/