[FEATURE]: Support for dynamic auth prompts and CLI login improvements #8516

Open
opened 2026-02-16 18:10:10 -05:00 by yindo · 1 comment
Owner

Originally created by @yinglj on GitHub (Feb 4, 2026).

Originally assigned to: @thdxr on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

What is the problem?

Currently, the authentication system in OpenCode only supports a single apiKey field. This limits the integration of third-party plugins that require multi-field inputs (e.g., username, password, or custom selection dropdowns). Additionally, the CLI auth login command always requires interactive selection, even if the user already knows the provider ID they want to connect to.

What is the proposed solution?

I propose expanding the authentication framework to support dynamic metadata:

  1. Dynamic Prompts: Allow plugins to define an array of input field requirements (text, password, select).
  2. UI Rendering: Update the connection dialog to dynamically render these fields based on the provider's metadata.
  3. Flexible Storage: Extend the auth data schema to persist multiple fields via a standard record object instead of just a single key.
  4. CLI Shortcuts: Update the auth login command to accept a provider ID as a positional argument (e.g., opencode auth login opencode or opencode auth login other), skipping unnecessary menus.

What are the benefits?

  • Enables seamless integration of complex model providers and enterprise-grade authentication flows.
  • Improves efficiency for power users by providing command-line shortcuts for common login tasks.
  • Makes the plugin system more robust and developer-friendly.
Originally created by @yinglj on GitHub (Feb 4, 2026). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request ### What is the problem? Currently, the authentication system in OpenCode only supports a single `apiKey` field. This limits the integration of third-party plugins that require multi-field inputs (e.g., username, password, or custom selection dropdowns). Additionally, the CLI `auth login` command always requires interactive selection, even if the user already knows the provider ID they want to connect to. ### What is the proposed solution? I propose expanding the authentication framework to support dynamic metadata: 1. **Dynamic Prompts**: Allow plugins to define an array of input field requirements (text, password, select). 2. **UI Rendering**: Update the connection dialog to dynamically render these fields based on the provider's metadata. 3. **Flexible Storage**: Extend the auth data schema to persist multiple fields via a standard `record` object instead of just a single `key`. 4. **CLI Shortcuts**: Update the `auth login` command to accept a provider ID as a positional argument (e.g., `opencode auth login opencode` or `opencode auth login other`), skipping unnecessary menus. ### What are the benefits? - Enables seamless integration of complex model providers and enterprise-grade authentication flows. - Improves efficiency for power users by providing command-line shortcuts for common login tasks. - Makes the plugin system more robust and developer-friendly.
yindo added the discussion label 2026-02-16 18:10:10 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 4, 2026):

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

  • #5748: Proposal: Provider Auth v2 (encrypted credential vault + multi-account OAuth + same-request rotation) - Comprehensive auth system redesign that directly addresses the multi-field auth framework
  • #7701: [FEATURE]: Reload auth.json if changed - Runtime detection of auth changes to support dynamic credential updates
  • #10939: auth login should confirm before running well-known auth.command - Directly addresses CLI login command improvements with provider ID support
  • #1302: Request to support Dynamic API keys through an apiKeyHelper - Precursor feature for dynamic credential management
  • #6088: [FEATURE]: Header-Based Credential Injection - Extends auth data schema to support multiple credential types and dynamic field injection
  • #11830: feat: Multi-Account OAuth Support with Auto-Relogin - Multi-field auth implementation for OAuth providers
  • #11478: [FEATURE]: Add MCP OAuth authentication UI to settings - Dynamic connection dialog for provider authentication

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 4, 2026): This issue might be a duplicate of existing issues. Please check: - #5748: Proposal: Provider Auth v2 (encrypted credential vault + multi-account OAuth + same-request rotation) - Comprehensive auth system redesign that directly addresses the multi-field auth framework - #7701: [FEATURE]: Reload auth.json if changed - Runtime detection of auth changes to support dynamic credential updates - #10939: auth login <url> should confirm before running well-known auth.command - Directly addresses CLI login command improvements with provider ID support - #1302: Request to support Dynamic API keys through an apiKeyHelper - Precursor feature for dynamic credential management - #6088: [FEATURE]: Header-Based Credential Injection - Extends auth data schema to support multiple credential types and dynamic field injection - #11830: feat: Multi-Account OAuth Support with Auto-Relogin - Multi-field auth implementation for OAuth providers - #11478: [FEATURE]: Add MCP OAuth authentication UI to settings - Dynamic connection dialog for provider authentication Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8516