Building an OAuth Flow in a Node.js CLI
summary
Builds a working three‑legged OAuth2 authorization_code flow inside a Node CLI, using readline for the shell, fs-extra to persist tokens in a hidden JSON, and the Dropbox SDK plus HTTP.createServer to catch the callback. Shows that Express struggled so native HTTP is used, the access token is issued without a refresh token (long‑lived), curl and API calls list folders to verify success, and stored tokens are read, validated and deleted as needed.
AI-written summary · about
chapters (30)
- 0:00Introduction
- 1:18Overview
- 2:02Seattle
- 2:36Dont take yourself too seriously
- 2:53The API economy
- 3:29The theoretical app
- 4:22OAuth
- 7:19Consent Screen
- 7:31Scopes
- 7:59Scopes Explained
- 8:52Actors Explained
- 9:21OAuth Tokens Explained
- 10:19Authorization Server Explained
- 11:02OAuth Flows
- 11:58Threelegged OAuth Flow
- 13:32Requesting Authorization
- 16:34Requesting Access Token
- 18:58Calling API
- 20:51What is a CLI
- 21:16CLI frameworks
- 22:59Readline
- 24:44Token Storage
- 27:56Using a stored token
- 33:08Application overview
- 33:23Code overview
- 35:26Get OAuth token
- 37:17Redirect response
- 38:03Authorization URL
- 40:08OAuth token
- 43:40Wrap up








