Authentication & Authorization Interview Questions and Answers

Sessions, tokens, OAuth 2.0, OIDC, RBAC and common attacks.

Practise 10 random 2 peer-reviewed questions
Authentication & Authorization Interview Syllabus & Preparation Strategy

Whether you are preparing for entry-level Authentication & Authorization interview questions for freshers or senior software engineer interview questions addressing concurrency, scalability, and system architecture, this track provides peer-reviewed model answers with syntax walkthroughs, edge cases, and practical interview tips.

1 How do you revoke a JWT before it expires? Hard

A stateless JWT cannot be un-issued, so revocation needs supporting state.

Options:

  • Denylist: store revoked token identifiers (jti) until their exp, and check on each request. Simple but adds a lookup and grows with volume.
  • Token version or pwd_at claim: keep a per-user counter or password-change timestamp in the user record; reject tokens whose claim is older. A single update revokes all of a user's tokens.
  • Short access tokens plus refresh-token revocation: keep access tokens to minutes and revoke the refresh token server-side, so the session dies quickly. This is the most common production approach.
  • Central introspection: resource servers call the authorization server (as with opaque tokens) to validate, trading statelessness for control.
if (token.exp < now) reject
if (denylist.has(token.jti)) reject
if (token.ver < user.tokenVersion) reject

For immediate global logout, the version or session-store approach is cleaner than a large denylist. Cache validation results briefly to limit overhead.

2 How would you design machine-to-machine authentication? Hard

For service-to-service calls, avoid shared static credentials and long-lived secrets.

  • OAuth 2.0 client credentials: each service is a registered client with a client id and secret, and obtains a short-lived access token scoped to what it needs. Prefer private key JWT or mTLS client authentication over a shared secret.
  • Mutual TLS: both sides present certificates, giving cryptographic service identity. Short-lived certificates issued by an internal CA or SPIFFE identities work well in a service mesh.
  • Workload identity: cloud platforms issue short-lived tokens bound to the workload's identity, removing static keys.
POST /token
grant_type=client_credentials&scope=orders:read

Apply least privilege with narrow scopes and audiences, rotate secrets automatically, store them in a secret manager, and never bake them into images. Add authorization checks on the callee, not just authentication, and audit token issuance. For third-party integrations, prefer per-tenant credentials so one leak does not compromise everyone.

Frequently Asked Questions About Authentication & Authorization Interviews

What do hiring managers evaluate in Authentication & Authorization technical rounds?

Technical interviewers look for foundational fluency, idiomatic syntax, clarity when communicating complex logic, and awareness of performance trade-offs (e.g. memory footprint, render performance, and network latency) in production environments.

What are the best interview tips for practicing Authentication & Authorization questions?

Use active recall: summarize each answer in your own words before revealing the model solution. Focus on explaining why a certain approach is chosen rather than just memorizing code syntax.