IAM interview questions · IAM architectures
APIs and microservices
The interview question“How do you secure authorization across microservices?”
In plain wordsA ticket checked at the stadium gate, again at your sector, and a steward who checks your exact seat.
Scenario 1 of 5
Three layers of checks
In plain words The gateway checks the ticket at the entrance, each service checks it again, and a policy engine answers the detailed questions.
Technical details
Coarse-grained authorization at the edge (valid token, scopes, rate limits), service-level validation (audience, claims), fine-grained decisions (this user, this object) in code or a policy engine such as OPA or a ReBAC service.
Scenario 2 of 5
Marco opens his orders
In plain words The web app sends the ticket. The gateway checks the signature with the public keys and lets the call through to Orders.
Technical details
The BFF keeps tokens server side and sends a cookie to the browser. The gateway validates signature (cached JWKS), iss, aud, exp and the scope orders:read. Orders still checks aud and that the order belongs to sub.
Scenario 3 of 5
Orders needs Payments, on Marco’s behalf
In plain words Orders does not forward Marco’s ticket as it is: it swaps it for a new, smaller ticket valid only for Payments.
Technical details
OAuth 2.0 Token Exchange (RFC 8693): subject_token = user token, audience = payments, reduced scopes. The new token keeps the user (sub) and names the calling service (act). Forwarding the same token everywhere makes every service a replay risk.
Scenario 4 of 5
Can Marco refund this payment?
In plain words Having a valid ticket is not enough. Payments asks: is this his payment, and is the amount within his limit?
Technical details
Object-level authorization is where most API breaches happen (BOLA, OWASP API1). Centralise the rules in a policy engine, keep enforcement in the service, log every decision.
Scenario 5 of 5
A partner system downloads invoices
In plain words No person involved: the partner’s server shows its own badge and gets only the invoices it is allowed to see.
Technical details
Client credentials with private_key_jwt or mTLS, scope invoices:read, tenant claim to filter data, per-client rate limits and quotas at the gateway.
How it works
Clients get tokens from an authorization server (OIDC + PKCE for users, client credentials for machines). The API gateway validates them and applies coarse rules and rate limits. Each service validates again (audience, scopes) and makes the fine-grained decision, often asking a policy engine.
Between services, exchange tokens instead of forwarding them: each hop gets a token for that audience, with fewer scopes, still carrying the user. Keys come from JWKS, cached and rotated.
A concrete example
An e-commerce platform: the web BFF calls Orders with the user token; Orders exchanges it for a Payments token; Payments asks the policy engine whether this user can refund this order; a logistics partner reads only its shipments with client credentials.
Mistakes to avoid
- Validating only at the gateway and trusting everything behind it.
- Forwarding the same broad token to every service.
They may also ask you
- JWT or opaque tokens with introspection?
- How do you test authorization rules?