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

Open
opened 2026-02-16 17:41:56 -05:00 by yindo · 1 comment
Owner

Originally created by @Davincible on GitHub (Dec 27, 2025).

Originally assigned to: @rekram1-node on GitHub.

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

Originally created by @Davincible on GitHub (Dec 27, 2025). Originally assigned to: @rekram1-node on GitHub. 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: ```bash 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
Author
Owner

@github-actions[bot] commented on GitHub (Dec 27, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #5391: [FEATURE]: multiple auth profiles per provider - discusses managing multiple profiles per provider
  • #6217: Have multiple instances of the same provider - requests the ability to have multiple instances of the same provider with different credentials

Both of these issues describe related scenarios where multiple authentication credentials/instances for the same provider are needed. Your issue describes a specific bug where only one plugin's auth methods survive, which is the technical manifestation of this limitation.

Feel free to ignore if this is addressing a different specific case.

@github-actions[bot] commented on GitHub (Dec 27, 2025): This issue might be a duplicate of existing issues. Please check: - #5391: [FEATURE]: multiple auth profiles per provider - discusses managing multiple profiles per provider - #6217: Have multiple instances of the same provider - requests the ability to have multiple instances of the same provider with different credentials Both of these issues describe related scenarios where multiple authentication credentials/instances for the same provider are needed. Your issue describes a specific bug where only one plugin's auth methods survive, which is the technical manifestation of this limitation. Feel free to ignore if this is addressing a different specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3916