Skip to content

Commit 45df2db

Browse files
committed
1.2.2
Move repo references to superagents-lab and switch CLI auth to OAuth 2.1 PKCE.
1 parent f574525 commit 45df2db

14 files changed

Lines changed: 876 additions & 157 deletions

File tree

‎README.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ s1 update
3535

3636
## Setup
3737

38-
Sign in with your browser and let the CLI save your API key automatically:
38+
Authorize the CLI with OAuth 2.1 in your browser. The CLI dynamically registers
39+
as a public client, uses Authorization Code with PKCE, and refreshes access
40+
tokens automatically:
3941

4042
```bash
4143
s1 login
@@ -146,7 +148,7 @@ s1 balance
146148

147149
### login
148150

149-
Authorize in your browser and save your API key automatically.
151+
Authorize in your browser with OAuth 2.1 and PKCE.
150152

151153
```bash
152154
s1 login
@@ -160,6 +162,7 @@ Manage CLI configuration.
160162
```bash
161163
s1 config set-key <key> # Save API key manually
162164
s1 config show # Show current config
165+
s1 config clear # Remove saved OAuth tokens and API keys
163166
```
164167

165168
### update
@@ -178,7 +181,7 @@ This repo also includes a [Claude Code](https://claude.com/claude-code) skill th
178181
Install the skill:
179182

180183
```bash
181-
npx skills add fatwang2/search1api-cli
184+
npx skills add superagents-lab/search1api-cli
182185
```
183186

184187
Once installed, you can ask Claude things like:

‎install.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -euo pipefail
33

4-
REPO="fatwang2/search1api-cli"
4+
REPO="superagents-lab/search1api-cli"
55
BINARY_NAME="s1"
66

77
# Detect OS

‎package-lock.json‎

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "search1api-cli",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "CLI tool for Search1API - web search, news, crawl, sitemap, reasoning and trending",
55
"type": "module",
66
"bin": {
@@ -9,6 +9,8 @@
99
},
1010
"scripts": {
1111
"build": "tsc",
12+
"test": "npm run build && node --test tests/*.test.mjs",
13+
"test:oauth:e2e": "npm run build && node --test tests/oauth-e2e.test.mjs",
1214
"dev": "tsc --watch",
1315
"start": "node dist/index.js",
1416
"build:binary": "bun run scripts/build-binary.ts",
@@ -25,6 +27,14 @@
2527
"crawl"
2628
],
2729
"license": "MIT",
30+
"repository": {
31+
"type": "git",
32+
"url": "git+https://github.com/superagents-lab/search1api-cli.git"
33+
},
34+
"homepage": "https://github.com/superagents-lab/search1api-cli#readme",
35+
"bugs": {
36+
"url": "https://github.com/superagents-lab/search1api-cli/issues"
37+
},
2838
"engines": {
2939
"node": ">=18.0.0"
3040
},

‎src/api.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import { getApiKey, API_BASE } from "./config.js";
1+
import { fetchWithAuth } from "./auth.js";
2+
import { API_BASE } from "./config.js";
23

34
export async function request<T>(
45
path: string,
56
body: Record<string, unknown>
67
): Promise<T> {
7-
const apiKey = getApiKey();
88
const url = `${API_BASE}${path}`;
99

10-
const res = await fetch(url, {
10+
const res = await fetchWithAuth(url, {
1111
method: "POST",
1212
headers: {
1313
"Content-Type": "application/json",
14-
Authorization: `Bearer ${apiKey}`,
1514
},
1615
body: JSON.stringify(body),
1716
});

0 commit comments

Comments
 (0)