mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-04-28 11:59:29 +00:00
feat: DigitalOcean OAuth2 flow for automatic token provisioning (#1716)
* feat: add DigitalOcean OAuth2 flow for automatic token provisioning Implements the OAuth2 authorization code flow for DigitalOcean as an alternative to manual API token entry. The flow mirrors the existing OpenRouter OAuth pattern using Bun.serve() for the local callback. Changes: - Add tryDoOAuth() with local Bun.serve callback, CSRF state, and code-for-token exchange via DO's /v1/oauth/token endpoint - Add tryRefreshDoToken() for refreshing expired tokens without re-authorization - Extend config persistence with refresh_token, expires_at, auth_method - Modify ensureDoToken() flow: env var -> saved config (with refresh) -> OAuth browser flow -> manual paste fallback - OAuth is gated on DO_OAUTH_CLIENT_ID and DO_OAUTH_CLIENT_SECRET env vars - Add 37 tests covering config persistence, CSRF generation, code validation, token expiry, URL construction, and feature toggle - Bump CLI version to 0.6.5 Closes #1715 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: hardcode DO OAuth credentials, remove env var gate Embed client_id and client_secret as constants (same pattern as gh CLI, doctl, gcloud). OAuth is now always available — no env vars needed. Public CLI clients cannot keep secrets confidential; security comes from the authorization code flow itself (user consent, localhost redirect, CSRF state, single-use codes). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add droplet:delete scope for spawn delete support The spawn CLI's destroyServer() calls DELETE /droplets/{id} which requires the droplet:delete scope. All its required sub-scopes (droplet:read, regions:read, sizes:read, actions:read, image:read) were already present. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude <claude@anthropic.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
32a54d317b
commit
e527d79815
3 changed files with 746 additions and 21 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@openrouter/spawn",
|
||||
"version": "0.6.4",
|
||||
"version": "0.6.5",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"spawn": "cli.js"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue