OAuth 2.0 is the standard for delegated authorization — it's what powers "Sign in with Google" and lets an app access your data on another service without ever seeing your password. Instead, the service issues a scoped token that grants limited access.
The authorization-code flow
- Your app redirects the user to the provider (Google, GitHub) to log in and consent to specific permissions.
- The provider redirects back with a one-time authorization code.
- Your app exchanges that code (plus its client secret) for an access token.
- The app sends the token with API requests to act on the user's behalf, limited to the granted scopes.
Scopes & refresh
Scopes limit what the token can do ("read your email" vs "manage your files"), so users grant only what's needed. Access tokens expire; a refresh token obtains new ones without re-prompting the user.
Key takeaways
- 01OAuth 2.0 delegates limited access to your data without sharing your password.
- 02Flow: consent → authorization code → exchange for an access token.
- 03Scopes limit what the token can do; users grant only what is needed.
- 04Refresh tokens obtain new access tokens without re-prompting.
- 05Use a vetted library — never implement the flow by hand.
