โ API Security learning pathAPI Security ยท Module 2 of 8
Authentication
Prove who is calling.
๐ Key ideas
- Authentication answers 'who are you?'; use proven methods such as OAuth 2.0 / OpenID Connect or a trusted identity provider.
- Send tokens in the Authorization header over HTTPS, never in the URL, where they end up in logs.
- Access tokens should be short-lived; refresh tokens let clients get new ones safely.
- Verify every token on the server: signature, expiry, issuer and audience.
- Protect login with rate limits, strong password hashing (such as bcrypt or Argon2) and multi-factor options.
๐ก Real-life example: A token is like a cinema ticket with the show time printed: the usher checks it is genuine and for this show before letting you in, and it is useless the next day.
AuthenticationChecking who the caller is
Access tokenShort-lived credential sent with each request
Refresh tokenCredential used to get a new access token
Password hashingStoring passwords as one-way scrambled values