Skip to content
Tech Interview Prep
Technical interview guide

Authentication vs. Authorization

Proving who you are versus what you're allowed to do, and the protocols behind each.

Read
26 min
Practice MCQs
25
Interview Q&A
25
Edition
v3
Editorial status
Reviewed

Scope: NIST SP 800-63 Revision 4, OWASP Cheat Sheet Series, and RFC 6750 guidance accessed 2026-08-31..

Curated: · Written: · Reviewed:

25 questions

MCQ-1A request reaches the API gateway carrying a JWT. The gateway holds only the client's registered public key and the token's claims; it verifies the signature and the `exp` claim, then forwards the request to the handler, which loads the record and applies the access policy. Which question has the gateway answered once the signature verifies?
MCQ-2A gateway has already verified the OIDC ID token's signature and expiry, resolved `sub` to `u-4471`, and confirmed the session cookie carries a 256-bit random identifier. The request `PATCH /invoices/8842` is then denied because `u-4471` holds only `viewer` on tenant `t-19`, the tenant that owns invoice 8842. Which question did that denial answer?
MCQ-3In a multi-tenant app, an invoice belongs to a tenant and any member of that tenant may read it. A user signed in to tenant A opens /invoices/41, edits the path to /invoices/42, and the API returns an invoice belonging to tenant B. The gateway validates the JWT, the route middleware requires the invoice:read role, and the handler runs SELECT * FROM invoices WHERE id = $1. Which check is missing?
MCQ-4A SaaS admin console renders its "Delete tenant" button only when the decoded JWT carries `role: "admin"`. During a pentest, a user whose token says `role: "support"` opens devtools, copies the request the button would send, `DELETE /api/v1/tenants/8842` with their own bearer token, and the tenant is deleted; the API returns 204. The endpoint verifies the JWT signature and that the tenant belongs to the caller's org, but never reads the `role` claim. Which change actually closes the hole?
MCQ-5An API gateway authorizes each request by calling a policy service that returns the first rule matching the request's (role, method, path) tuple, or `matched: false` when none matches. The gateway is configured so that a request is served only when the policy service returns a matching permit rule. A request arrives with a valid, unexpired token for role `analyst`: `GET /v2/reports/export`. The policy service returns HTTP 200 with `{"matched": false}`. What should the gateway return to the client?
MCQ-24A document service defines three roles and four actions. The policy allows owner: read, write, share, delete; editor: read, write, share; viewer: read. The authorization suite runs the eight allowed role-action pairs and asserts each returns 200; all eight pass. A viewer then deleted a document in production. Which change to the suite would have caught that?
MCQ-14A payments dashboard's SPA signs users in through an OAuth 2.0 authorization server and calls the API with the JWT access token it receives. The token's claims are `iss`, `sub`, `aud`, `exp`, `scope` and `client_id`. The dashboard now has to display the signed-in user's email address and the time the user actually authenticated, and it must verify both itself without calling the API. The authorization server publishes a discovery document at `/.well-known/openid-configuration`. What should the team change?
MCQ-15A resource API validates bearer JWTs by verifying the signature against the issuer's JWKS and requiring aud to equal the API's own identifier; it does not inspect the typ header or any scope claim. A mobile client sends the ID token from its OIDC login instead of the access token, and the API returns 401. Which property of the ID token causes that rejection?
MCQ-12An authorization server issues RS256 JWTs with `iss: https://auth.example.com`, a 15-minute `exp`, a `scope` claim, and `aud` set to the identifier of the API the token was requested for. `orders-api` and `billing-api` both validate tokens against the same JWKS endpoint, and both require the `reports:read` scope on their reporting endpoints. A client holding a token with `aud: "orders-api"`, `scope: "reports:read"`, `iat: 10:00`, `exp: 10:15`, and `kid: "k2"` sends it at 10:07 to `billing-api`'s reporting endpoint. `billing-api`'s JWKS cache holds `k1` and `k2`, and the token's signature verifies against `k2`. What should `billing-api` do?
MCQ-10An API gateway validates access tokens by verifying the JWT signature against the issuer's JWKS and checking the exp claim, and by nothing else. A mobile app's access token, issued at 09:00 with a 30-minute lifetime, is copied out of a crash log at 09:05 and replayed from an attacker-controlled host at 09:20. What does the gateway do with the replayed request?
MCQ-11A single-page app calls its own API and loads a charting library from a third-party CDN. After a release, the security team finds the access token in the browser's history and in the CDN's logs. Which placement of the token explains both findings?
MCQ-13A mobile app (client_id ios-app) runs authorization code + PKCE against https://auth.example.com with scope=openid. The token response carries expires_in 3600, scope "openid" and an id_token. Decoded access token payload: {"iss":"https://auth.example.com","sub":"user:alice","aud":"https://api.example.com","client_id":"ios-app","scope":"openid","exp": now+3600}. Three seconds after minting, the app calls GET https://api.example.com/v1/me with that access token. The gateway validates the signature against the current JWKS, sees the token is unexpired, and forwards the request; the service answers 403 {"error":"insufficient_scope","required":"profile:read"}. ios-app is registered at the authorization server for openid, profile:read and offline_access, and Alice already consented to profile:read on the web app. Which change makes the next GET /v1/me return 200?
MCQ-21Forty batch jobs run on a Kubernetes cluster, each taking about 90 minutes. They authenticate to an object store with a projected service account token whose TTL the platform team caps at 3600 s; the kubelet rewrites the token file before the token expires. After moving off static keys, every job now fails with 401 at about minute 61, while jobs that finish under an hour succeed. The application reads the token file once at startup and keeps the value in memory. What fixes the failures?
MCQ-6`billing-api` runs three replicas behind `edge-gw`. `edge-gw` verifies the caller's JWT, sets `X-User-Id` to the token's `sub`, and deletes any client-supplied `X-User-Id`. Each replica reads `X-User-Id` and caches that user's role set in an in-process map keyed by the header string, TTL 60 s; the service has no JWT validation code of its own. The service is also reachable inside the cluster at `billing-api.default.svc.cluster.local:8080`, a path that does not pass through `edge-gw`. Replica `billing-api-1` currently holds `{"alice": ["admin"], "bob": ["viewer"]}`, both entries written 10 s ago. A pod sends `GET /invoices/42` to `billing-api-1` with `X-User-Id: bob` and no JWT. What does `billing-api-1` do?
MCQ-22A support console issues an impersonation token with claims `sub: cust_8812` and `act: {sub: agent_4471}`. The API gateway's audit middleware reads only `sub` and writes it to `actor_id`, one row per request. On day 1, agent_4471 impersonates cust_8812 for 22 minutes and deletes 40 records. On day 3, an investigator queries `actor_id = 'cust_8812'` and finds the 40 deletion rows attributed to the customer, with no agent named. The session store that mapped tokens to agents was purged after 24 hours. The breach report reads `actor_id` to list affected accounts; the security team reads `impersonator_id` to list acting agents. Which change to the middleware would have let the investigator name agent_4471 as the acting agent while keeping cust_8812 as the affected account?
MCQ-8app.example.com sets its session cookie as `Set-Cookie: sid=…; Secure; HttpOnly; SameSite=Strict; Path=/`. A signed-in user clicks a plain `<a href="https://app.example.com/dashboard">` link on https://partner.example.net. That first request gets a 302 to /login; the app bounces signed-in users from /login to /dashboard, and pressing reload in the same tab lands on /dashboard. DevTools shows the cookie still stored with 6 hours left before expiry. Which mechanism explains the first request?
MCQ-9A storefront at https://shop.example.com sets its session cookie as `Set-Cookie: sid=8f2a...; HttpOnly; Secure; SameSite=Lax`. A stored XSS payload in a product review runs in the page context of https://shop.example.com/cart. The cart page's own JavaScript reads a CSRF token from `<meta name="csrf-token" content="...">` and sends it in the `X-CSRF-Token` header on every POST to /api/cart/add. The victim is logged in with the cart page open. Which outcome does the payload produce?
MCQ-7An app keeps sessions in a server-side map from session ID to a record holding userId (null before login). An attacker visits the site, gets session ID S1, and plants S1 in the victim's browser. The victim visits with S1 and logs in; the handler creates a new record S2 with userId=victim, sets the S2 cookie, and leaves the S1 record as it was. The attacker then sends a request carrying cookie S1. What does the server do?
MCQ-20A SaaS product logs in with a password plus a TOTP code. Its recovery flow emails a 4-digit code that stays valid for 30 minutes and accepts unlimited attempts. For one account, the logs show 360,000 code submissions from a single IP over 30 minutes, then one success, followed by a password change and a new TOTP enrollment. No password or TOTP code was ever accepted. Which explanation accounts for the success?
MCQ-19A console issues 8-hour OIDC sessions. Deleting a production database requires `acr=gold` (hardware security key) and an `auth_time` no older than 5 minutes. An operator signed in at 09:00 with a hardware key, so the session carries `acr=gold` and `auth_time=09:00`. At 09:40 they click Delete database. The console re-runs the authorization request with `acr_values=gold`; the provider returns the same session unchanged and the delete proceeds. What is the defect?
MCQ-16A team ships a native iOS and Android app that is a public OAuth client: it holds no client secret and receives the authorization code on the custom URI scheme `com.example.app:/cb`. The authorization server already enforces exact `redirect_uri` matching, and the app sends a per-session `state` value. Which risk does adding PKCE with the S256 method remove?
MCQ-17A client's OAuth callback handler: ```python STATE = secrets.token_urlsafe(32) # module level, set at import @app.get("/oauth/callback") def callback(code, state): if state != STATE: abort(400) session["uid"] = exchange_code(code)["sub"] return redirect("/") ``` A pentester starts an authorization flow in their own browser, copies the resulting callback URL (code and state), and sends it to a logged-out victim. The victim opens the link and is signed in as the pentester. Which change rejects that link while leaving normal sign-ins working?
MCQ-18An authorization server validates `redirect_uri` by checking that the requested value starts with the registered value, character for character. A client has registered `https://app.example.com`. An attacker sends a victim to the authorization endpoint with `redirect_uri=https://app.example.com.metrics.example/steal`, and the victim approves. What happens?
MCQ-23A service caches authorization decisions in-process, keyed by (subject, resource, action), with a fixed 60 s TTL, no refresh on hit, and no revocation push. A user's allow for document D is written to the cache at t = −5 s. At t = 0 s an admin revokes the user's access to D. Requests for D arrive at t = +10 s, +50 s, +58 s and +65 s. Which sequence of outcomes does the cache produce?
MCQ-25Your document service authorizes every read and write against a central policy service. The documented degraded mode, used only while the circuit breaker is open, is: reads may use a cached allow if the cached resource version matches the request version and the cache entry is at most 60 seconds old; writes always deny, even with a cached allow; no cache entry means deny. The system's revocation SLA is 5 minutes, so a 60-second cached read stays inside the designed bound. During a 90-second policy-service outage, 100 protected requests arrive: 40 reads with a cached allow whose version matches and age is 12 s; 20 reads with a cached allow whose version matches and age is 45 s; 15 reads with a cached allow whose version does not match and age is 10 s; 10 writes with a cached allow whose version matches and age is 10 s; 15 requests with no cache entry. All tokens are valid. What should the service return?