0
0
HLDsystem_design~3 mins

Why OAuth 2.0 flow in HLD? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

What if you could share your house keys without ever giving out your real keys?

The Scenario

Imagine you want to let your friend borrow your house keys to water your plants while you're away. You give them a copy of your house key directly. Now, they can enter your house anytime, even when you don't want them to.

The Problem

Giving out your main key (like your password) to every app or service is risky. It's slow to manage, easy to lose control, and if someone misuses it, your whole account is at risk. You have to change your password everywhere if something goes wrong.

The Solution

OAuth 2.0 flow acts like a special guest pass system. Instead of sharing your main key, you give apps a limited-time, limited-access pass. This pass lets them do only what you allow, and you can revoke it anytime without changing your main password.

Before vs After
Before
username = input('Enter username')
password = input('Enter password')
login(username, password)
After
access_token = get_oauth_token()
use_token(access_token)
What It Enables

OAuth 2.0 flow enables secure, controlled, and easy sharing of your account access without exposing your password.

Real Life Example

When you sign into a new app using your Google or Facebook account, OAuth 2.0 flow is working behind the scenes to safely share your identity without giving away your password.

Key Takeaways

Manual sharing of passwords is risky and hard to manage.

OAuth 2.0 flow provides limited, revocable access tokens instead of passwords.

This makes app integrations safer and easier for users and developers.