🛂 API & Integration · APIs & Integration
Authentication vs Authorization
Authentication asks who you are; authorization asks what you may do.
Logging in does not automatically give permission to everything.
A manager and employee both authenticate, but only the manager may approve expenses.
💡 Authentication is showing your ID at the door; authorization is which rooms your keycard actually opens once you are inside.
💡 Why it matters
Mixing these two up is a common source of security holes. Proving who you are is not the same as being allowed to do a given action. Keeping them separate lets you check identity once and then enforce fine-grained permissions on every sensitive operation.
🛠️ How to achieve it
⚠️ Signs of trouble
- •Any logged-in user can reach admin-only actions.
- •Permissions are checked only in the browser.
- •One role quietly has access to everything.
- •Identity is confirmed but actions are never permission-checked.
🎯 Quick check
Score: 0/3Three questions to test the idea.
1. What does authentication establish?
Answer: Who you are
Authentication proves identity — who the caller is. What they may do is authorization.
2. A user is logged in. Can they do everything?
Answer: No — each sensitive action must still be authorized
Logging in only proves identity. Authorization still decides, per action, what that identity is allowed to do.
3. Where must permission checks be enforced?
Answer: On the server
Hiding a button in the UI is not security; the server must enforce the permission so no caller can bypass it.
