OAuth2 Roles and Authorization Flow
You'll learn the four key players in OAuth2 and how they interact to delegate authorization safely.
The Four OAuth2 Roles
OAuth2 defines exactly four roles that participate in every authorization scenario:
1. Resource Owner
The user who owns the data or resource. This is you when you click "Sign in with Google" — you own your Google account data.
2. Client
The application requesting access on behalf of the resource owner. That third-party app asking to access your Google contacts is the client.
3. Authorization Server
The trusted server that authenticates the resource owner and issues access tokens. Google's OAuth server fills this role when you approve access.
4. Resource Server
The API server hosting the protected resources. Google's Contacts API is the resource server that checks tokens before serving data.
The Authorization Flow Sequence
Think of it like entering a concert with a VIP pass:
- Client asks Resource Owner: "Can I access your data?" (You click "Sign in with Google")
- Resource Owner tells Authorization Server: "Yes, give this app limited access" (You approve on Google's login page)
- Authorization Server gives Client an access token (A temporary VIP pass)
- Client shows token to Resource Server: "Here's my pass!" (Client calls the API with the token)
- Resource Server validates token and serves data (API returns the contacts)
The beauty: the client never sees your password. The authorization server handles authentication, then issues a token proving permission was granted.
Key Takeaway: OAuth2 separates concerns using four roles—resource owner (user), client (app), authorization server (issues tokens), and resource server (protects data)—enabling secure delegation without sharing credentials.