Skip to content

[Feature] Standardized RFC 8628 (Device Authorization Flow) for CLI Authentication #16

@zhdaniel12

Description

@zhdaniel12

Problem Statement:

Currently, CLI tools built on the apcore framework (such as aisee-cli) that require user authentication often implement the Device Authorization Flow (RFC 8628) in a fragmented and redundant manner. Developers have to manually code the logic for:

  1. Requesting device/user codes from the Auth server.
  2. Displaying verification instructions to the user.
  3. Managing the asynchronous polling state to retrieve tokens.
  4. Handling token persistence, expiration checks, and silent background refreshes.

This leads to a lack of consistency in User Experience (UX) across different tools and increases the risk of insecure token handling.

Proposed Solution:

Integrate a first-class, configuration-driven Authentication capability into apcore-cli.

  • Declarative Configuration: Allow developers to enable authentication by simply providing Auth Server endpoints (device code, token, refresh) in the CLI configuration.
  • Standardized UI/UX: Provide a built-in login command handler that manages terminal output (e.g., using ora for polling status, chalk for user-code highlighting, and
    open for browser invocation).
  • Automatic Token Lifecycle: The framework should automatically handle the storage of Access and Refresh tokens (standardized per OS), validate token expiry before
    command execution, and perform silent refreshes without business logic intervention.
  • Architectural Separation: Implement the core protocol logic within apcore-toolkit for platform-agnostic reuse, while keeping the interactive UI components within
    apcore-cli.

Value Proposition:

  • Developer Efficiency: Reduces the "Time-to-Hello-World" for authenticated CLIs from hours to minutes.
  • Security by Design: Centralizes sensitive token management within the framework, reducing the attack surface.
  • Unified UX: Ensures a consistent and professional login experience across the entire apcore ecosystem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions