Loading Depth Study
Preparing your workspace
Authentication verifies identity, while authorization checks whether the authenticated identity has permission to perform an action.
Protected APIs need a way to determine who is making a request. Common mechanisms include secure session-based authentication and token-based authentication. After authentication, authorization determines whether the user can access a resource or perform an operation. Permissions should always be enforced by the server or database rather than only hiding controls in the frontend. APIs should also avoid exposing sensitive user information unnecessarily.
A student may read their own progress, a mentor may manage assigned students, and an admin may manage platform users.
GET /api/admin/users Authorization: Bearer <access-token>
The API receives authentication information and verifies that the current user is allowed to access the admin resource.