API Security & Authentication: Protecting Your APIs
API Security & Authentication: Protecting Your APIs
Up to 20 questions, shuffled on every run
Welcome to the API Security & Authentication Quiz! This quiz will test your knowledge of key concepts and best practices for securing APIs. Each question is designed to challenge your understanding of authentication, authorization, OAuth2, JWT, API keys, HTTPS, CORS, rate limiting, and common vulnerabilities. Good luck!
Answer key and explanations20 questions
The quiz above draws 20 questions at random from these 30, so a second attempt will not be the same run. Everything in the pool is listed here.
What is the difference between authentication and authorization?
AnswerAuthentication verifies user identity; authorization manages user permissions
What is OAuth2?
AnswerAn authorization framework for delegating access to third-party applications
What is a JWT (JSON Web Token)?
AnswerA stateless, self-contained token used to securely transmit encoded data
What are the three parts of a JWT?
AnswerHeader (algorithm), Payload (claims), and Signature (verification)
What is an API key, and when should it be used?
AnswerA simple identifier for public access, basic usage, and rate limiting
What is HTTPS, and why is it critical for APIs?
AnswerA secure transport protocol using TLS to prevent data interception
What is CORS (Cross-Origin Resource Sharing) in APIs?
AnswerA mechanism that uses HTTP headers to allow cross-domain resource access
What is rate limiting in API security?
AnswerRestricting the number of requests a user can make in a specific timeframe
What is a brute force attack on APIs?
AnswerAttempting to guess credentials by trying many combinations in rapid succession
What is injection attack vulnerability?
AnswerInserting malicious commands through input fields to execute unauthorized code
What is XSS (Cross-Site Scripting)?
AnswerExecuting malicious scripts in the browser of users viewing a web page
What is CSRF (Cross-Site Request Forgery)?
AnswerForcing an authenticated user to execute unwanted actions on a trusted site
What is the principle of least privilege in API security?
AnswerProviding users only the minimum access levels required to perform their jobs
What is a refresh token, and why is it used?
AnswerA long-lived token used to obtain new access tokens without re-authenticating
What is two-factor authentication (2FA)?
AnswerRequiring two independent forms of evidence to verify a user identity
What is token expiration, and why is it important?
AnswerLimiting the valid lifetime of a token to reduce the risk of misuse
What is the difference between session-based and token-based authentication?
AnswerSessions store state on the server; tokens are stateless and self-contained
What is a salt in password hashing?
AnswerUnique random data added to a password before hashing to prevent collisions
What is the purpose of Content Security Policy (CSP)?
AnswerAn HTTP header that restricts the sources from which scripts can load
What is API versioning, and how does it relate to security?
AnswerManaging API updates to fix security flaws without breaking existing clients
What is API authentication vs. authorization in microservices?
AnswerServices verify each other identities and then check specific access rights
What is the responsibility of the API provider vs. client in security?
AnswerProviders secure the infrastructure; clients secure their tokens and requests
What is API key rotation, and why is it important?
AnswerPeriodically replacing API keys to minimize damage if a key is leaked
What is secrets management in API authentication?
AnswerUsing specialized tools to securely store and inject API credentials
What is mutual TLS (mTLS) authentication?
AnswerA process where both the client and server verify each other certificates
What is the difference between public and private APIs?
AnswerPublic APIs are open to external users; private APIs are internal only
What is webhook security?
AnswerVerifying the authenticity of incoming callbacks using signatures
What are GraphQL-specific security concerns?
AnswerRisks involving recursive queries, introspection, and field permissions
What is the importance of logging and monitoring API security?
AnswerDetecting patterns of abuse, failed logins, and unauthorized access
What is API documentation and security?
AnswerClearly explaining security requirements without leaking internal details









