Interview Q&A · questions with model answers
Authentication Interview Questions
Part of the study plan for: Backend Engineer · Full Stack Engineer
Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.
-
Most asked What are the most common JWT security pitfalls?
Accepting alg: none or the wrong algorithm, not validating exp/aud/iss, using weak HMAC secrets, storing tokens in localStorage, putting sensitive data in the payload, very long expiry without…
-
Most asked What is multi-factor authentication, and which factors are strongest?
MFA requires two or more independent factors: something you know (password), have (device, security key) or are (biometric). Phishing-resistant factors like FIDO2/WebAuthn security keys and passkeys…
-
What are passkeys (WebAuthn) and why are they phishing-resistant?
Passkeys are public-key credentials created per website; the private key stays on the user's device (or synced via a platform keychain) and signs a server challenge. Because the browser binds the…
-
What is session fixation and how do you prevent it?
In session fixation, an attacker makes the victim use a session ID the attacker knows (e.g., via a crafted link), then waits for the victim to log in, inheriting the authenticated session. Prevent…
-
What is user enumeration and how do you avoid it?
User enumeration is when an attacker learns which accounts exist from different responses or timing in login, registration or password-reset flows. Avoid it with identical messages and similar…
-
What is the Backend-for-Frontend (BFF) pattern for authentication in SPAs?
A BFF is a server component that performs the OAuth/OIDC flow, keeps tokens server-side, and gives the browser only an HttpOnly session cookie. The SPA calls the BFF, which attaches access tokens to…
-
What are OAuth scopes, and are they enough for authorization?
Scopes are coarse permissions granted to a client application by the user (e.g., read:orders), limiting what the token can be used for. They're not sufficient on their own: the API must still check…
-
What signals and controls help detect account takeover?
Watch for impossible travel, new devices or locations, many failed logins, password reset followed by email change, unusual API usage, and token reuse. Respond with step-up MFA, session revocation,…
-
What are sender-constrained tokens (DPoP, mTLS-bound tokens)?
Sender-constrained tokens are bound to a key the client holds, so a stolen token can't be used by another party. DPoP has the client sign each request with a private key whose thumbprint is bound in…
-
What are the security considerations of passwordless magic links?
Magic links are as secure as the user's email account. Make tokens random, single-use, short-lived, and bound to the requesting device or session where possible; protect against email scanners that…
-
What does zero trust mean for authentication?
Zero trust means no implicit trust based on network location: every request is authenticated and authorized using strong identity (user and device), least privilege, and continuous evaluation of…
-
What is HTTP Basic authentication and when is it acceptable?
Basic auth sends username:password base64-encoded in the Authorization header on every request. It's acceptable only over HTTPS for simple internal tools or machine clients, ideally combined with…