QA interview guide

How would you test authentication?

Authentication is a security-critical system, not only a login form. A strong interview answer covers credentials, password rules, account states, MFA, tokens, sessions, refresh, logout, authorization, and abuse prevention.

Write your own answer and compare it with senior QA coverage.

What interviewers expect

What interviewers expect

Interviewers expect valid and invalid login, password validation, lockout and rate limiting, MFA if supported, token and session handling, refresh and expiry, logout, role access, brute force protection, user enumeration, and security headers.

Checklist

Checklist

Use these practical prompts to build a complete answer. Strong interview responses usually include functional behavior, negative cases, security, backend/data risks, UX, accessibility, and reliability.

Login, password rules, and account states

  • Valid credentials return expected token, session, user profile, role, and redirect or API response.
  • Invalid password, unknown email, empty fields, malformed email, and disabled account are handled safely.
  • Password rules, password visibility, password reset entry point, and password change impact are covered.
  • Locked, disabled, unverified, deleted, and suspended account states behave correctly.
  • MFA, SSO, remember me, trusted device, and recovery code flows work if supported.

Tokens, sessions, and logout

  • Access token creation, expiry, refresh flow, refresh token rotation, and reused refresh token rejection are tested.
  • Session timeout, idle timeout, remember-me lifetime, logout, logout all devices, and browser-back behavior work.
  • Expired, invalid, malformed, revoked, and wrong-audience tokens are rejected.
  • Role access, tenant access, and protected API access are enforced after authentication.
  • Password reset, password change, role change, and account disable invalidate sessions when required.

Security and abuse prevention

  • Error messages do not reveal whether the account exists.
  • Rate limiting, brute-force protection, lockout, CAPTCHA, suspicious attempt handling, and IP/email throttling work.
  • Tokens, cookies, and session ids use secure flags and are not leaked in URLs, logs, analytics, or client storage.
  • CSRF, XSS, open redirect, token replay, token theft, and session fixation risks are checked.
  • Security headers, CORS behavior, HTTPS, cookie SameSite, and cache-control are verified.

UX, reliability, and observability

  • Loading, error, locked account, MFA challenge, expired session, and recovery states are clear.
  • Keyboard navigation, labels, focus states, screen reader errors, and mobile layout work.
  • Backend errors, identity provider outage, timeout, retry, and degraded auth service states are recoverable.
  • Audit logs, security alerts, metrics, correlation ids, and diagnostic logs support investigation.
  • High login volume and repeated failed attempts stay within performance expectations.

Complete interview coverage checklist

Aim to mention 20-40 concrete checks. This expanded list helps you turn a short answer into a structured senior-style response.

Valid credentials return expected token, session, user profile, role, and redirect or API response.
Invalid password, unknown email, empty fields, malformed email, and disabled account are handled safely.
Password rules, password visibility, password reset entry point, and password change impact are covered.
Locked, disabled, unverified, deleted, and suspended account states behave correctly.
MFA, SSO, remember me, trusted device, and recovery code flows work if supported.
Access token creation, expiry, refresh flow, refresh token rotation, and reused refresh token rejection are tested.
Session timeout, idle timeout, remember-me lifetime, logout, logout all devices, and browser-back behavior work.
Expired, invalid, malformed, revoked, and wrong-audience tokens are rejected.
Role access, tenant access, and protected API access are enforced after authentication.
Password reset, password change, role change, and account disable invalidate sessions when required.
Error messages do not reveal whether the account exists.
Rate limiting, brute-force protection, lockout, CAPTCHA, suspicious attempt handling, and IP/email throttling work.
Tokens, cookies, and session ids use secure flags and are not leaked in URLs, logs, analytics, or client storage.
CSRF, XSS, open redirect, token replay, token theft, and session fixation risks are checked.
Security headers, CORS behavior, HTTPS, cookie SameSite, and cache-control are verified.
Loading, error, locked account, MFA challenge, expired session, and recovery states are clear.
Keyboard navigation, labels, focus states, screen reader errors, and mobile layout work.
Backend errors, identity provider outage, timeout, retry, and degraded auth service states are recoverable.
Audit logs, security alerts, metrics, correlation ids, and diagnostic logs support investigation.
High login volume and repeated failed attempts stay within performance expectations.
Structure your answer: Start with valid login, invalid login, password rules, and account states.
Structure your answer: Add session and token behavior: expiry, refresh, rotation, logout, and role access.
Structure your answer: Add security: brute-force protection, lockout, generic errors, enumeration prevention, headers, and token leakage.
Structure your answer: Close with MFA, backend failures, observability, accessibility, mobile layout, and performance.
Do not miss: Refresh token rotation and reused token detection.
Do not miss: Security headers and cookie settings.
Do not miss: Authorization checks after authentication succeeds.
Do not miss: User enumeration and token leakage in logs or URLs.

Ready to practice?

Practice this scenario interactively

Write your own answer and compare it with senior QA coverage.

Practice this scenario

Answer structure

Strong answer structure

  1. Start with valid login, invalid login, password rules, and account states.
  2. Add session and token behavior: expiry, refresh, rotation, logout, and role access.
  3. Add security: brute-force protection, lockout, generic errors, enumeration prevention, headers, and token leakage.
  4. Close with MFA, backend failures, observability, accessibility, mobile layout, and performance.

Common missed areas

Common missed risks

Refresh token rotation and reused token detection.
Security headers and cookie settings.
Authorization checks after authentication succeeds.
User enumeration and token leakage in logs or URLs.

Answer template

Use this interview answer template

I would start with login success and failure, then cover password rules, lockout, MFA, token and session handling, refresh and expiry, logout, role access, brute-force protection, user enumeration, security headers, backend failures, accessibility, and performance.

Use it as a structure, then replace the examples with specific checks for the feature you are discussing.

Common weak answer

“I would test valid and invalid cases.”

This is too generic because it does not show risk thinking. A stronger answer names the happy path, negative cases, security risks, backend/data behavior, UX/accessibility, and reliability concerns that matter for this exact scenario.

Examples

Weak answer vs stronger answer

Weak answer
I would test login with correct and wrong password.

That is a useful start, but authentication also needs password rules, account states, token lifecycle, session handling, MFA, abuse protection, secure storage, authorization, and backend reliability.

Stronger answer
I would test valid login, invalid password, unknown email, empty fields, password rules, locked and disabled accounts, MFA challenge, SSO account, remember me, logout, logout all devices, session timeout, access token expiry, refresh token rotation, reused refresh token rejection, revoked token, generic error messages, rate limiting, brute-force protection, lockout, CAPTCHA after suspicious attempts, user enumeration prevention, secure cookies, SameSite and cache-control headers, token not exposed in URLs, logs, analytics, or client storage, CSRF and XSS protection, open redirect blocked, protected API access, role and tenant authorization, password reset session invalidation, backend timeout, identity provider outage, audit logs, metrics, keyboard navigation, screen reader errors, mobile layout, and high-volume login performance.

FAQ

Frequently asked questions

What should I mention first when answering "How would you test authentication?"

Start with valid login, invalid login, password rules, and account states.

Should I include negative and edge cases?

Yes. Add invalid inputs, empty states, duplicates, expired states, service failures, and recovery paths.

Should I include security, API, or backend risks?

Error messages do not reveal whether the account exists. Rate limiting, brute-force protection, lockout, CAPTCHA, suspicious attempt handling, and IP/email throttling work.

What are common missed risks?

Refresh token rotation and reused token detection. Security headers and cookie settings. Authorization checks after authentication succeeds. User enumeration and token leakage in logs or URLs.

How can I practice this answer?

Use the interactive how would you test authentication? challenge to write your own answer, get checklist-based feedback, and compare your coverage with stronger QA thinking.

Practice

Practice this scenario interactively

Write your own answer and compare it with senior QA coverage.

Practice this scenario