Sign in from a command-line interface (CLI) through the system browser.
A command-line interface (CLI) can open the system browser for user sign-in, then receive the authorization result through a local callback or another approved return mechanism.
Why this lesson?
A developer uses a command-line app on a laptop. They want to approve its access through their normal browser sign-in.
Learning goal and prerequisites
Open the system browser
The command-line interface (CLI) creates a browser authorization transaction. It generates the state value and Proof Key for Code Exchange values, starts a temporary local callback when that pattern is supported, and opens the system browser to the authorization server.
Inspect request, response, and claims
Try a failure scenario
↳ Change a condition
Read the detailed explanation
Why it exists, how it works, and where it fits
Command-line tools need user authorization too, but they often cannot safely collect passwords or display a full sign-in interface. A common design is to let the command-line client start OAuth while the user completes authentication and consent in the system browser.
The command-line client creates the authorization request and opens the browser. The user signs in at the authorization server, not inside the command-line tool. The browser then returns an authorization code to a local callback or another approved redirect mechanism. The client exchanges that code for tokens using Proof Key for Code Exchange (PKCE).
This is useful because the client never needs to handle the user’s primary password, and the authorization server can use the same sign-in and multifactor controls it uses for normal web applications. The user can also see which permissions the command-line client is requesting.
The client still has to protect the returned code and tokens, validate state and redirect behavior, and store long-lived credentials carefully. A command-line interface changes the user experience, but it does not remove the normal OAuth security requirements.
Investigation
Inspect the traffic, select a diagnosis in the checkpoint, then reveal the repair.
Check your understanding
Pass the lesson quiz
Answer every question correctly to unlock the next lesson. Retry as often as you need.