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
DeviceCodeLoginprovides bothConnect()andConnectAsync()withCancellationTokensupport, giving callers proper async/cancellation control.DefaultBrowserLogin.Connect()currently blocks synchronously onAuthorizationCodeExtractor.Listen()and hardcodesConsole.CancelKeyPressfor cancellation. This means:Proposed change:
ConnectAsync(string appliance, ..., CancellationToken cancellationToken)toDefaultBrowserLoginAuthorizationCodeExtractor.Listencancellation-token-aware (or add an async overload)CancellationTokeninstead of hardcodingConsole.CancelKeyPressConnect()as a sync wrapper for backward compatibility