Skip to content

Commit 3c611da

Browse files
lohnimclaude
andcommitted
docs: update README with browser auth flow and auth command reference
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c65f4c4 commit 3c611da

1 file changed

Lines changed: 41 additions & 13 deletions

File tree

README.md

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,23 @@ alchemy completions fish > ~/.config/fish/completions/alchemy.fish
3939

4040
### Authentication Quick Start
4141

42-
Authentication is required before making requests. Configure auth first, then run commands.
43-
44-
If you are using the CLI as a human in an interactive terminal, the easiest path is:
42+
Authentication is required before making requests. The recommended path is browser login:
4543

4644
```bash
47-
alchemy
45+
alchemy auth
4846
```
4947

50-
Then follow the setup flow in the terminal UI to configure auth.
48+
This opens a browser to link your Alchemy account, then prompts you to select an app. The selected app's API key is saved to your config automatically. Pass `-y` to skip the confirmation prompt.
49+
50+
If you run `alchemy` with no command and no auth configured, the CLI will guide you through browser login automatically.
51+
52+
If you have an auth token but haven't selected an app yet, the CLI will prompt you to pick one before running any command that requires an API key. Teams with many apps can type to search by name.
5153

52-
Know which auth method does what:
54+
Other auth methods are available for specific use cases:
5355

54-
- **API key** - direct auth for blockchain queries (`balance`, `tx`, `block`, `nfts`, `tokens`, `rpc`)
55-
- **Access key** - Admin/API app management; app setup/selection can also provide API key auth for blockchain queries
56-
- **x402 wallet auth** - wallet-authenticated, pay-per-request model for supported blockchain queries
56+
- **API key** direct auth for blockchain queries (`balance`, `tx`, `block`, `nfts`, `tokens`, `rpc`)
57+
- **Access key** Admin API app management; app setup/selection can also provide API key auth for blockchain queries
58+
- **x402 wallet auth** wallet-authenticated, pay-per-request model for supported blockchain queries
5759

5860
If you use Notify webhooks, add webhook auth on top via `alchemy config set webhook-api-key <key>`, `--webhook-api-key`, or `ALCHEMY_WEBHOOK_API_KEY`.
5961

@@ -165,6 +167,9 @@ Use `alchemy help` or `alchemy help <command>` for generated command help.
165167
| Command | What it does | Example |
166168
|---|---|---|
167169
| `(no command)` | Starts interactive REPL mode (TTY only) | `alchemy` |
170+
| `auth` (`auth login`) | Log in via browser (PKCE) | `alchemy auth` |
171+
| `auth status` | Show current authentication status | `alchemy auth status` |
172+
| `auth logout` | Clear saved authentication token | `alchemy auth logout` |
168173
| `apps list` | Lists apps (supports pagination/filtering) | `alchemy apps list --all` |
169174
| `apps chains` | Lists Admin API chain identifiers (e.g. `ETH_MAINNET`) | `alchemy apps chains` |
170175
| `apps get <id>` | Gets app details | `alchemy apps get <app-id>` |
@@ -231,6 +236,7 @@ Additional env vars:
231236

232237
| Command | Flags |
233238
|---|---|
239+
| `auth login` | `--force`, `-y, --yes` |
234240
| `nfts` | `--limit <n>`, `--page-key <key>` |
235241
| `nfts metadata` | `--contract <address>` (required), `--token-id <id>` (required) |
236242
| `tokens` | `--page-key <key>` |
@@ -258,17 +264,39 @@ Additional env vars:
258264

259265
## Authentication Reference
260266

261-
The CLI supports three auth inputs:
267+
The CLI supports four auth methods:
262268

263-
- API key for blockchain queries (`balance`, `tx`, `block`, `nfts`, `tokens`, `rpc`)
264-
- Access key for Admin API operations (`apps`, `chains`, configured network lookups`) and app setup/selection, which can also supply the API key used by blockchain query commands
265-
- x402 wallet key for wallet-authenticated blockchain queries in a pay-per-request model
269+
- **Browser login** (recommended) — log in via `alchemy auth`, then select an app to automatically configure your API key
270+
- **API key** — direct auth for blockchain queries (`balance`, `tx`, `block`, `nfts`, `tokens`, `rpc`)
271+
- **Access key** — Admin API operations (`apps`, `chains`, configured network lookups`) and app setup/selection, which can also supply the API key used by blockchain query commands
272+
- **x402 wallet key** — wallet-authenticated blockchain queries in a pay-per-request model
266273

267274
Notify/webhook commands use a webhook API key with resolution order:
268275
`--webhook-api-key` -> `ALCHEMY_WEBHOOK_API_KEY` -> `ALCHEMY_NOTIFY_AUTH_TOKEN` -> config `webhook-api-key` -> configured app webhook key.
269276

270277
Get API/access keys at [alchemy.com](https://dashboard.alchemy.com/).
271278

279+
#### Browser login (recommended)
280+
281+
```bash
282+
# Interactive login — opens browser to link your Alchemy account
283+
alchemy auth
284+
285+
# Skip the confirmation prompt
286+
alchemy auth -y
287+
288+
# Force re-authentication
289+
alchemy auth login --force
290+
291+
# Check auth status
292+
alchemy auth status
293+
294+
# Log out
295+
alchemy auth logout
296+
```
297+
298+
After login, the CLI prompts you to select an app. The app's API key is saved to config and used for all subsequent commands. If you skip app selection during login, the CLI will prompt you to pick one before running any command that needs an API key.
299+
272300
#### API key
273301

274302
```bash

0 commit comments

Comments
 (0)