Security, Privacy, and Consumer Protection
Every time you click “Sign in with Google” or connect a third-party app to Slack, you’re using OAuth 2.0. Instead of sharing your password with every service, OAuth lets you delegate limited access through tokens. It’s the modern standard for letting apps talk to each other on your behalf — without giving away the keys to your account.
In this activity, you’ll see OAuth in action twice: first by watching a live demo of connecting a third-party app, and then by running through a hands-on OAuth implementation to see exactly how the authorization flow works under the hood.
By the end of this session, you should be able to:
Your instructor will demonstrate connecting a third-party app to a service (e.g., adding an app to Slack, connecting GitHub to a tool, or linking a calendar app).
As you watch, answer:
Think about:
Clone the demo repository and follow the setup instructions:
git clone https://github.com/patrickbucher/oauth2-demo.git
cd oauth2-demo
Read the README to understand the architecture. The demo has three servers:
Start all three servers according to the README instructions.
Open http://localhost:9000 in your browser and request access to the gossip.
Watch what happens:
You get redirected to the authorization server. Look at the URL — what parameters are included? What is client_id
? What is state
for?
Log in and authorize the client (use the credentials from the README).
You get redirected back to the client. Look at the URL again — what changed? Do you see an authorization code?
The client now displays the gossip. Behind the scenes, it exchanged the authorization code for an access token and used that token to fetch the data.
Open your browser’s Developer Tools (Network tab) and repeat the flow. Try to identify:
Open the source code and find where these things happen:
Look at how tokens are created. Are they random strings, or do they contain information (like JWTs)?
Try these experiments to see what security properties OAuth has:
state
parameter in the callback URL. Does the client accept it?Let’s talk about what you learned:
state
parameter prevent?Think about the design:
We’ll wrap up by discussing when you’d use OAuth vs. other approaches — and what additional protocols (like OpenID Connect) build on top of it.