From 939f91630ebe25915dfdc590a0920c6bc7621899 Mon Sep 17 00:00:00 2001 From: Kevin Wang Date: Sun, 2 Aug 2026 14:41:51 -0700 Subject: [PATCH] feat: add cross-device OAuth login --- CHANGELOG.md | 17 ++ README.md | 7 +- __tests__/auth.test.ts | 125 ++++++++- __tests__/bundled-skills.test.ts | 4 + __tests__/connect.test.ts | 68 ++++- __tests__/login.test.ts | 415 ++++++++++++++++++++++++++++++ package-lock.json | 4 +- package.json | 2 +- skills/anyapi-onboarding/SKILL.md | 21 +- src/api.ts | 24 +- src/auth.ts | 48 +++- src/commands.ts | 41 ++- src/connect.ts | 131 ++-------- src/constants.ts | 1 + src/index.ts | 7 +- src/login.ts | 163 ++++++++++++ src/oauth.ts | 153 +++++++++++ src/types.ts | 15 +- 18 files changed, 1105 insertions(+), 141 deletions(-) create mode 100644 __tests__/login.test.ts create mode 100644 src/login.ts create mode 100644 src/oauth.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e2fcab..1ea2c04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 0.5.0 - 2026-08-02 + +### Added + +- `anyapi login` now starts the RFC 8628 OAuth device flow when no manual key is + supplied. It prints the verification URL and user code, opens the complete URL + best-effort, follows the server polling interval and `slow_down`, and stores the + same access token, refresh token, expiry, and scope fields as `anyapi connect`. + Account sessions refresh automatically before the one-hour access token expires. + +### Changed + +- `anyapi login --api-key aa_live_...` remains the manual-key compatibility path + and clears any unrelated OAuth or trial state before selecting that key. +- `login` is the immediate cross-device account sign-in path; `connect` remains + the Authorization Code + PKCE loopback path for upgrading a free trial. + ## 0.3.3 ### Changed diff --git a/README.md b/README.md index 7227429..afe89cd 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,8 @@ anyapi run reddit.search --input '{"query":"anyapi","limit":5}' - `anyapi signup [--label