API Security, Authentication and Authorization Questions

Controlling who can call an API, what they may do, and defending it against abuse. Covers the access-control mechanics: API keys, OAuth 2.0 flows, OpenID Connect, JWT issuance/validation, session vs. token auth, scopes/roles for fine-grained authorization, token lifetime and refresh, mutual TLS, and machine-to-machine vs. user-delegated access. Also covers the adversarial hardening view: input validation, injection and deserialization risks, broken object-level authorization (BOLA), mass assignment, secrets handling, and the OWASP API Security Top 10, plus securing data in transit, preventing enumeration/scraping, and testing APIs for vulnerabilities.

EasyTechnical
69 practiced

Explain the difference between authentication and authorization in the API context. Describe two common authentication methods (JWT bearer tokens and OAuth2 Authorization Code flow) and two authorization models (role-based access control RBAC and attribute-based access control ABAC). For each, give a short example of when it is appropriate.

HardTechnical
61 practiced

How would you handle authentication token lifecycle and rotation for long-lived API clients such as IoT devices? Include token issuance, refresh, rotation, revocation, offline device handling, heartbeat strategies, secure storage on device, and methods for detecting and responding to token compromise.

MediumTechnical
49 practiced

Explain OAuth 2.0 concepts relevant to APIs: scope-driven authorization, access tokens (JWT vs opaque), refresh tokens, and token revocation. Compare the trade-offs of short-lived JWTs with no introspection versus opaque tokens with centralized introspection for internal and external APIs.

MediumTechnical
56 practiced

Walk through the API key management lifecycle you'd put in place: issuance workflow, key metadata (owner, scopes, creation time), secure storage (hashed keys vs plaintext), rotation policies (automatic/manual), revocation propagation, and tying rate limits/auditing to keys. Describe how to discover keys across services and how to handle emergency revocation.

MediumTechnical
58 practiced

Describe a secure API error-handling policy: what to return to clients vs what to log internally, how to classify errors (client vs server), how to avoid exposing stack traces or sensitive info, and strategies for redaction, correlation IDs, and enabling safe debug modes in non-production environments.

Unlock Full Question Bank

Get access to all 27 API Security, Authentication and Authorization interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.