Authorization determines what an authenticated user is allowed to do within your application. While authentication verifies identity ('Who are you?'), authorization controls access ('What can you do?'). It ensures regular users can't access admin panels, free users can't use premium features, and users can only edit their own data.
Authentication gets users in the door. Authorization decides which rooms they can enter.
Users have roles, roles have permissions:
| Role | Can View | Can Edit | Can Delete | Can Admin |
|---|---|---|---|---|
| User | Own data | Own data | Own data | No |
| Editor | All content | All content | Own content | No |
| Admin | Everything | Everything | Everything | Yes |
Users can only access resources they own:
Authorization checks happen in multiple places:
When asking AI to add authorization: