Backend and APIs · Question 17 of 50
What is the difference between authentication and authorization? And 401 against 403?
What they're checking
Security vocabulary, and the right status codes.
The answer
Authentication is proving who you are: a password, an OTP, a token. Authorization is deciding what you may do: an admin can delete, a viewer cannot. Authenticate first, then authorize every request, on the server: hiding a button in the UI is not a permission check.
401 Unauthorized means not authenticated: no credentials, or bad ones, so log in. 403 Forbidden means authenticated but not allowed. Some APIs answer 404 instead of 403 so as not to reveal that the thing exists.
The picture
request ─▶ WHO are you? ──no──▶ 401
│ yes
▼
MAY you do this? ──no──▶ 403
│ yes
▼
200The follow-up they'll ask
What is RBAC?
Show the answer
Role-based access control: permissions belong to roles such as admin or editor, and users get roles. Attribute-based control adds rules like "only your own team's records".
Your progress stays on this device.