Course contentsShow
← Software Engineering
Lesson 1017 of 1,93331. Authentication and AuthorizationFree lesson

OAuth2 Fundamentals and the Delegation Problem

Understanding the core problem OAuth2 solves: delegating access without sharing credentials.

OAuth2 Fundamentals and the Delegation Problem

What you'll learn: How OAuth2 solves the problem of granting third-party access to your resources without sharing your password.

The Core Problem: Sharing Access Without Sharing Credentials

Imagine you want to let a photo printing service access your photos stored on a cloud platform. The naive approach would be giving the printing service your username and password — but this creates serious problems:

  • The printing service now has full access to everything in your account
  • You can't revoke access to just the printing service without changing your password everywhere
  • If the printing service gets hacked, your credentials are compromised
  • There's no way to limit what the printing service can do

This is the delegation problem: how do you grant limited, temporary access to a third party without giving away the keys to your entire kingdom?

How OAuth2 Solves It

OAuth2 introduces a system where you never share your password. Instead:

  1. The third-party app (printing service) redirects you to the authorization server (cloud platform)
  2. You authenticate with your actual credentials only on your cloud platform
  3. After you approve, the cloud platform gives the app a special access token
  4. The app uses this token (not your password) to access your photos
  5. The token has limited scope (just photos) and expires after some time

Think of it like a hotel key card versus the master key. The hotel gives you a card that only opens your room and only works during your stay — not the master key that opens everything forever.

Key Takeaway: OAuth2 solves the delegation problem by replacing password sharing with scoped, temporary access tokens, allowing third parties to act on your behalf without ever learning your credentials.