Auth MechanicsAUTHENTICATION & AUTHORIZATION, FROM THE WIRE UP.
LESSON 18 OF 40

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
ONE NEW IDEA 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.
Review the previous lesson if any of these terms are new. The link below opens that lesson.
Request sequence Authorization sequence
STEP 01

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
Traffic inspector Examples only · not real requests
Try a failure scenario

↳ Change a condition

Read the detailed explanation
Key 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.

Check your understanding
Lesson checkpoint

Pass the lesson quiz

Answer every question correctly to unlock the next lesson. Retry as often as you need.

Glossary Definitions of technical terms