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.

  1. Most asked What is the difference between authentication and authorization?

    Authentication (authN) verifies who you are; authorization (authZ) decides what you're allowed to do. Authentication happens first and produces an identity; authorization uses that identity (plus…

  2. Most asked Compare session-based authentication with token-based (JWT) authentication.

    Sessions store state on the server and give the browser an opaque session ID cookie; token-based auth gives the client a signed token (often a JWT) containing claims that servers verify without a…

  3. Most asked What are OAuth 2.0 and OpenID Connect, and how do they differ?

    OAuth 2.0 is an authorization framework for granting an application limited access to an API on a user's behalf (access tokens); OpenID Connect (OIDC) is an identity layer on top of OAuth that adds…

  4. What is Single Sign-On, and how do SAML and OIDC compare?

    SSO lets users authenticate once with an identity provider (IdP) and access many applications. SAML 2.0 is an older XML-based standard common in enterprise SaaS; OIDC is a JSON/JWT-based standard…

  5. When are API keys appropriate, and how do you manage them safely?

    API keys identify a calling application (often a customer's server) for simple machine-to-machine access. Generate high-entropy keys, show them once, store only a hash, scope them to permissions,…

  6. Should you build authentication yourself or use an identity provider?

    Use a proven identity provider (Auth0/Okta, Cognito, Entra ID, Keycloak, Clerk, Firebase Auth) or a well-maintained framework library unless you have strong reasons; authentication has many subtle…

  7. Why use constant-time comparison for secrets?

    Normal string comparison stops at the first differing byte, so response timing can leak how much of a secret (token, HMAC signature) an attacker guessed correctly. Constant-time comparison takes the…

Was this page helpful?

Report a mistake