[PR #5324] fix(auth): add plugin lookup for custom provider in 'Other' flow #11346

Closed
opened 2026-02-16 18:16:10 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5324

State: closed
Merged: Yes


Summary

  • Fix bug where plugins providing auth for custom providers were not discovered when users selected "Other" in the auth login flow
  • Add a second plugin lookup after the user enters a custom provider ID, enabling plugins like cursor-auth to work correctly

Problem

When running opencode auth login, selecting "Other", and typing a custom provider ID (e.g., "cursor"), OpenCode would prompt for an API key instead of triggering the plugin's OAuth flow.

Root cause: The plugin lookup (Plugin.list().then(x => x.find(x => x.auth?.provider === provider))) happened at the start of the handler when provider === "other", so no plugin matched. After the user typed the custom provider name, the provider variable was updated, but there was no second plugin lookup - it fell through directly to the API key prompt.

Solution

Added a second Plugin.list() lookup inside the "Other" block after the user enters the custom provider ID. This checks if any plugin provides authentication for that provider and handles the full OAuth/API key flow accordingly.

Testing

Tested with a local cursor-auth plugin:

  1. opencode auth login → Select "Other" → Type "cursor"
  2. Plugin is now discovered correctly
  3. OAuth flow is triggered and completes successfully
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5324 **State:** closed **Merged:** Yes --- ## Summary - Fix bug where plugins providing auth for custom providers were not discovered when users selected "Other" in the auth login flow - Add a second plugin lookup after the user enters a custom provider ID, enabling plugins like cursor-auth to work correctly ## Problem When running `opencode auth login`, selecting "Other", and typing a custom provider ID (e.g., "cursor"), OpenCode would prompt for an API key instead of triggering the plugin's OAuth flow. **Root cause**: The plugin lookup (`Plugin.list().then(x => x.find(x => x.auth?.provider === provider))`) happened at the start of the handler when `provider === "other"`, so no plugin matched. After the user typed the custom provider name, the `provider` variable was updated, but there was no second plugin lookup - it fell through directly to the API key prompt. ## Solution Added a second `Plugin.list()` lookup inside the "Other" block after the user enters the custom provider ID. This checks if any plugin provides authentication for that provider and handles the full OAuth/API key flow accordingly. ## Testing Tested with a local cursor-auth plugin: 1. `opencode auth login` → Select "Other" → Type "cursor" 2. Plugin is now discovered correctly 3. OAuth flow is triggered and completes successfully
yindo added the pull-request label 2026-02-16 18:16:10 -05:00
yindo closed this issue 2026-02-16 18:16:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11346