OAuth SSO Interview Questions: Answer With a Flow

Walk a login end to end: name the four actors, narrate authorization code with PKCE, validate tokens, and answer OAuth SSO interview questions with a trade-off at each step.

By AI Interview AssistantPublished 9 min read

Most oauth sso interview questions ask you to walk one real login end to end: which flow you would use, what each token is for, where the trust boundary sits, and what breaks when a token leaks. Answer by naming the actors, drawing the flow in order, and stating one trade-off at each step. Candidates rarely lose points on definitions. They lose them on mixing up authentication with authorization, or on skipping token validation.

The four actors you name before anything else

Say these in one breath, with the calendar example attached. It gives the interviewer a shared picture to point at.

  • Resource owner: the person who owns the data. A user signing into a calendar app with a company identity provider.
  • Client: the application asking for access. The calendar app.
  • Authorization server: the identity provider that authenticates the user and issues tokens. The company's login service.
  • Resource server: the API holding the data. The calendar API, which checks the access token on each request.

The distinction to state early: OAuth 2.0 delegates authorization, meaning access to a resource. OpenID Connect (OIDC) adds authentication, meaning who the user is, carried in an ID token. OAuth alone tells the API that someone granted access; it does not tell your app who that someone is.

The common mistake is calling the access token proof of identity. It is not. The ID token is the identity claim, meant for the client to read. The access token is the key to an API, meant for the resource server, and the client should treat its contents as opaque.

Authorization code with PKCE, drawn in order

Draw two vertical lines: the client on the left, the authorization server on the right, with the browser moving between them. Then number the steps as you speak.

  1. The client generates a code verifier and a challenge. The verifier is a random string; the challenge is a SHA-256 hash of it, sent in the first request.
  2. The browser is redirected to the authorization server with the client ID, redirect URI, requested scopes, state, and the code challenge.
  3. The user authenticates at the authorization server and consents. Credentials are entered only there.
  4. The authorization server redirects back with a short-lived, single-use code, checked against the redirect URI registered for the client.
  5. The client exchanges the code plus the original verifier for tokens. The server hashes the verifier, compares it with the challenge, and issues tokens only on a match.
  6. The client calls the resource server with the access token, and the resource server validates it before returning data.

Why the code is short-lived and single-use: if it is intercepted, it is useless after one exchange or a few seconds. PKCE closes the gap the implicit flow left open, where the token came back in the URL fragment and could be read from browser history or a referrer. The verifier proves the same client that started the flow is finishing it, so a stolen code cannot be redeemed by another app.

Name the redirect URI check as the control that stops a code being delivered to an attacker's app. It must be an exact match against the registered value, not a prefix or a wildcard, because a loose pattern lets an attacker register a lookalike callback.

A full sample answer, spoken in about three minutes

The scenario is a backend interview: "How would you add single sign-on to an internal dashboard using our company identity provider?" This is an illustrative answer, not a transcript.

I would use OIDC on top of OAuth 2.0 with the authorization code flow plus PKCE, even though the dashboard is a confidential server-side client. It costs one extra hash and it protects against code interception.

Two endpoints: a login route that generates the state and PKCE pair, stores them in the session, and redirects to the identity provider; and a callback route that checks the state matches, exchanges the code and verifier for tokens, and validates the ID token.

The session cookie is HttpOnly, Secure and SameSite=Lax, holding an opaque session ID; the tokens stay server-side. On the callback I validate the ID token's signature against the provider's published keys, then the issuer, the audience, the expiry and the nonce I stored before the redirect. Any failure means no session and a logged event.

The trade-off: a server-side session gives instant revocation but needs shared storage across instances. A stateless JWT scales without that storage, but revocation waits until expiry. For an internal dashboard I take the shared store.

What makes it work: every claim is checkable, the validation list is complete, and the trade-off is stated rather than hidden. Expect follow-ups on where the session lives, what happens when validation fails, and how logout works.

Token storage and expiry follow-ups

Where does the browser keep tokens? In memory, or in a short-lived cookie marked HttpOnly and SameSite, not localStorage. localStorage is readable by any script on the page, so one cross-site scripting bug hands over the token; an HttpOnly cookie is not reachable from JavaScript.

Then give numbers, labelled as an example policy:

TokenExample lifetimeRotationRevocation cost
Access token15 minutesNew one on each refreshShort window if leaked; expiry is the backstop
Refresh token8 hoursRotated on every useReuse detection revokes the family
Server-side sessionUntil idle timeoutNot applicableInstant, but needs shared storage

"What if the refresh token is stolen?" Answer with rotation and reuse detection: each refresh returns a new token and invalidates the old one, so a stolen token used after the real client refreshes trips an alarm and the whole family is revoked. Admit the residual risk: between theft and the next refresh, the attacker holds a valid token. Shortening the refresh lifetime narrows that window and costs the user more logins.

SSO questions: sessions, logout and multiple apps

One login at the identity provider creates a session there, and each application creates its own session after its callback. The identity provider is the only place credentials are entered; each app is a relying party that trusts its tokens.

Single logout must coordinate all of those sessions. The failure mode to name: one app keeps its own session after central logout, so the user appears signed out and is still signed in there. Unless every app participates in a logout notification or back-channel call, central logout is best-effort across applications. Say that plainly; it is the honest answer.

Where candidates mix up authentication and authorization

Three mix-ups come up again and again. Each has a one-line correction and a follow-up.

  1. Treating scopes as roles. Scopes limit what a token may do, not who the user is. Correction: roles belong in your authorization model, checked after authentication. Follow-up: where do you enforce the role check?
  2. Treating an ID token as an API credential. The ID token is for the client; the API expects an access token. Follow-up: what does the resource server validate?
  3. Assuming SSO means the app never sees a password. True for the app, but the identity provider still handles credentials and is now a high-value target. Follow-up: how do you protect that provider?

"Just use OAuth for login" is incomplete without OIDC. OIDC adds the ID token and a standard user-info endpoint, which is what makes login interoperable.

The one rule for the whiteboard

When unsure, draw the flow and label the trust boundary between client and authorization server before answering any detail question. The drawing buys you time and shows where each token crosses. Then state one assumption and one trade-off per answer. That is what separates a memorised definition from an engineer's answer. For the service design behind this flow, see the authentication service system design walkthrough, and to practise saying it aloud, read answering technical phone screen questions out loud.

Frequently asked questions

Is OAuth the same as SSO?

No. OAuth is a delegation framework for granting access to resources. SSO is a user experience in which one login gives access to several applications. OIDC, built on OAuth 2.0, supplies the authentication piece that makes SSO work, so the two are related but not the same thing.

What is the difference between an ID token and an access token in an interview answer?

The ID token is a signed claim about who the user is, meant for the client to read and validate. The access token is a credential for calling an API, meant for the resource server. Say that the client should not use the access token as proof of identity, and that the API should not accept the ID token as its key.

Do I need to know SAML as well as OAuth for SSO interviews?

Know what SAML is for: an XML-based standard for browser SSO, common in enterprise identity providers. You do not need to recite its assertions unless the role mentions it. If asked, say it solves the same login problem with a different format, and that OIDC is the newer choice for new applications.

What if the interviewer asks me to compare OAuth with API keys?

Say that an API key identifies an application and is long-lived and hard to scope per user, while OAuth issues scoped, expiring tokens tied to a user's consent. Then name the cost: OAuth adds a redirect flow, token storage and validation work. API keys fit server-to-server calls with no user in the loop.

How do I answer if I have never implemented SSO at work?

Say so, then walk the flow you would build and the validation checklist you would apply. Interviewers accept a reasoned design over a claimed history. Do not invent a project; instead show that you know where the trust boundary sits and what you would test first.

Practising login flow answers? See how AI Interview assistant works.

  • Oauth sso interview questions
  • Authentication interview questions
  • Sso interview questions
  • System design interview
  • Security interview
A heavy vault-style door in a bright lobby with a single brass key resting on a table in the foreground

10 min read

Authentication Service System Design Interview: Draw the Line

A boundary-first way to answer the authentication service system design interview: scope the prompt, draw the trust line, pick a session model and defend revocation out loud.

  • Authentication service system design interview
  • Design authentication service
Editorial photograph illustrating the article topic: Repeat the Question Interview

12 min read

Repeat the Question Interview: Ask Without Losing Flow

Asking an interviewer to repeat a question is normal. Here are three honest ways to ask, how to restate the question as your opening line, and how to practise it.

  • Repeat the question interview
  • How to repeat the question