[PR #12122] feat(auth): dynamic provider prompts and CLI login improvements #14075

Open
opened 2026-02-16 18:18:53 -05:00 by yindo · 0 comments
Owner

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

State: open
Merged: No


Fixes #12118

What does this PR do?

This PR enhances the authentication system to support plugins requiring multi-field inputs (prompts) and adds CLI shortcuts for direct login.

Key changes:

  • Core Update: Migrated from a single apiKey string to a flexible [data] record in the Auth.Api schema, allowing plugins to persist arbitrary credential fields.
  • Dynamic UI: Implemented a dynamic form renderer in the connection dialog that builds input fields (text, password, captcha, select) based on plugin metadata.
  • CLI Refresh: Updated opencode auth login to accept a provider ID as a shortcut. It now handles case-insensitive matching for both official providers and local plugins.
  • Fixes:
    • Added safety checks in the plugin loader to ignore non-function exports, preventing TypeError during initialization.
    • Fixed a binary-specific bug where compiled executables would try to use themselves as the bun manager, causing hangs during SDK synchronization.

How did you verify your code works?

  • Local Plugin Testing: Verified with a local plugin defining both username and password prompts. Confirmed fields are correctly rendered in the web UI and successfully persisted to the local config.
  • CLI Shortcuts: Confirmed opencode auth login Google and opencode auth login turingcoder correctly trigger the target auth flows from the terminal.
  • Build Stability: Successfully ran the --single build script and verified the resulting binary correctly references the system bun in PATH.
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12122 **State:** open **Merged:** No --- Fixes #12118 ### What does this PR do? This PR enhances the authentication system to support plugins requiring multi-field inputs (prompts) and adds CLI shortcuts for direct login. Key changes: - Core Update: Migrated from a single `apiKey` string to a flexible [data] record in the `Auth.Api` schema, allowing plugins to persist arbitrary credential fields. - Dynamic UI: Implemented a dynamic form renderer in the connection dialog that builds input fields (text, password, captcha, select) based on plugin metadata. - CLI Refresh: Updated `opencode auth login` to accept a provider ID as a shortcut. It now handles case-insensitive matching for both official providers and local plugins. - Fixes: - Added safety checks in the plugin loader to ignore non-function exports, preventing `TypeError` during initialization. - Fixed a binary-specific bug where compiled executables would try to use themselves as the `bun` manager, causing hangs during SDK synchronization. ### How did you verify your code works? - Local Plugin Testing: Verified with a local plugin defining both `username` and `password` prompts. Confirmed fields are correctly rendered in the web UI and successfully persisted to the local config. - CLI Shortcuts: Confirmed `opencode auth login Google` and `opencode auth login turingcoder` correctly trigger the target auth flows from the terminal. - Build Stability: Successfully ran the `--single` build script and verified the resulting binary correctly references the system `bun` in `PATH`.
yindo added the pull-request label 2026-02-16 18:18:53 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14075