5. You want to secure your API by rotating API keys regularly. Which approach best ensures security while allowing clients to continue using the API without interruption?
hard
A. Generate a new key, distribute it, then disable the old key after a grace period
B. Generate a new key and immediately disable the old key
C. Keep using the same key indefinitely to avoid client issues
D. Send the API key in the URL to make it easier to update
Solution
Step 1: Understand key rotation best practices
Rotating keys means replacing old keys with new ones to improve security.
Step 2: Ensure clients have time to update keys
Disabling old keys immediately can break clients; a grace period avoids this.
Final Answer:
Generate a new key, distribute it, then disable the old key after a grace period -> Option A
Quick Check:
Grace period = smooth key rotation [OK]
Hint: Use grace period when rotating keys to avoid downtime [OK]
Common Mistakes:
Disabling old key immediately causing client failures