Skip to content

Add ConnectAsync to DefaultBrowserLogin for consistency with DeviceCodeLogin #227

@petrsnd

Description

@petrsnd

DeviceCodeLogin provides both Connect() and ConnectAsync() with CancellationToken support, giving callers proper async/cancellation control.

DefaultBrowserLogin.Connect() currently blocks synchronously on AuthorizationCodeExtractor.Listen() and hardcodes Console.CancelKeyPress for cancellation. This means:

  • No way to cancel programmatically (e.g., timeout after N seconds)
  • Blocks the calling thread with no async alternative
  • Inconsistent API surface across login packages

Proposed change:

  • Add ConnectAsync(string appliance, ..., CancellationToken cancellationToken) to DefaultBrowserLogin
  • Make AuthorizationCodeExtractor.Listen cancellation-token-aware (or add an async overload)
  • Accept a caller-provided CancellationToken instead of hardcoding Console.CancelKeyPress
  • Keep existing Connect() as a sync wrapper for backward compatibility

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    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