Authentication vs Authorization
Authentication and authorization solve two different problems.
Authentication answers: "Who is making this request?"
Authorization answers: "Is this authenticated user allowed to perform this operation?"
For example, a GraphQL request may contain an access token. The server validates the token and identifies the user as user-42. That is authentication.
The server then checks whether user-42 is allowed to update order order-100. That is authorization.
A useful request flow is:
Request
↓
Extract credentials
↓
Authenticate identity
↓
Create GraphQL context
↓
Execute operation
↓
Authorize requested action
↓
Business logic
↓
Data source
Do not confuse authentication with authorization. A successfully authenticated user does not automatically have permission to perform every operation.
For example, an application may have these users:
alice— regular customerbob— support agentcarol— administrator
All three may authenticate successfully, but their permissions can be different.
GraphQL itself does not prescribe JWT, sessions, OAuth, cookies, or any particular authentication mechanism. Those are application and infrastructure decisions.
Who are you?What are you allowed to do?- Authentication establishes identity.
- Authorization determines permissions.
- GraphQL does not prescribe a specific authentication mechanism.
- Authentication success does not imply authorization success.
A user successfully presents a valid JWT but is not allowed to delete another user's account. Which security concern prevents the operation?