Skip to main content
A CLI can’t keep a secret, so it signs in with standard OAuth 2.0: authorization code with PKCE and a loopback redirect (RFC 8252). Use your language’s OAuth library.

Register The App

In the console, under Apps, create a Browser Or Native app with the redirect URI http://127.0.0.1/callback. Dari accepts it on any port, so your CLI can listen on whichever port is free.

Sign In

With golang.org/x/oauth2:
Go
Save the token in the user’s config directory, readable only by them (0600).

Make Requests

Go
If a refresh fails with invalid_grant, the user disconnected. Delete the saved token and sign in again.

Other Languages

Any OAuth 2.0 library with PKCE works the same way with the settings above, such as Authlib for Python or oauth2 for Rust.