opencode icon indicating copy to clipboard operation
opencode copied to clipboard

bug: multiple plugins registering auth for the same provider silently overwrite each other

Open Davincible opened this issue 2 weeks ago • 1 comments

When multiple plugins register authentication methods for the same provider (e.g., both opencode-antigravity-auth and opencode-websearch-cited register for google), only one plugin's methods are available. The other plugin's auth methods are silently discarded.

This affects both the CLI (opencode auth login) and the API (GET /provider/auth).

Root Cause

API (provider/auth.ts): Uses fromEntries() to build the methods map, which overwrites duplicate keys - last plugin wins.

CLI (cli/cmd/auth.ts): Uses .find() to get only the first matching plugin - first plugin wins.

Reproduction

  1. Install opencode-antigravity-auth and opencode-websearch-cited
  2. Run opencode auth login and select Google
  3. Only see "Google API key" - the Antigravity OAuth option is missing

Or via API:

curl -s http://127.0.0.1:7860/provider/auth | jq '.google'
# Returns only: [{ "type": "api", "label": "Google API key" }]

Expected

All auth methods from all plugins should be available for the same provider.

Fix

PR #6260

Davincible avatar Dec 27 '25 19:12 Davincible