microsoft / microsoft/winget-cli

Allow passing an external authentication token override instead of using the builtin authentication handler

Open
#6,492 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-COM-API Issue-Feature Possible-Duplicate PowerShell
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Relevant area(s)

COM API, WinGet CLI, PowerShell Module

Description of the new feature / enhancement

Summary

Add a command line argument as well as COM API support to supply an external authentication token, overriding the default authentication flow.

Background

The builtin authentication support (AppInstaller::Authentication) currently either supports no authentication or the use of Entra ID authentication via WebAuthenticationCoreManager. This has some shortcomings with unattended deployments:

  • WebAuthenticationCoreManager has bugs involving running programs as different users (#6186). This can be worked around when using WebAuthenticationCoreManager directly by delegating the user authentication flow to a helper process, but this is not possible when using WinGet, as its API does not allow passing in an external token but requires using the builtin WebAuthenticationCoreManager flow.
  • There is no way to make system-wide unattended installations work without user interaction, as WinGet does not support requesting a machine token. This would also require the device to have a corresponding Entra ID principal via a device attach / join.
  • --authentication-mode silent is not useful for unattended deployments as it does not guarantee success - after all, the user must have authenticated themselves at some point. It also requires WinGet to run as the user, not as LocalSystem, which isn't possible with users not having administrator access and the installer requiring elevation.

In our case, a user should be able to order software and have it installed without further interaction via our client management solution, where the software resides in a private WinGet repository protected from unauthorized access via Entra ID authentication - we don't need to authenticate as the user, we need to authenticate as an Entra ID principal we can grant access to, but WinGet doesn't allow for external authentication flows.

Proposed technical implementation details
  • Extend AuthenticationAccount with String AuthenticationToken;.
  • Extend the CLI interface with --authentication-token akin to --authentication-mode and --authentication-account.
  • Pass both values to AppInstaller::Authenticator as part of the AuthenticationArguments.
  • Adjust AppInstaller::Authentication::AuthenticateForToken to return the token from the authentication arguments, if present.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with AuthenticationAccount in src/Microsoft.Management.Deployment/PackageManager.idl, then trace the CLI options analogous to --authentication-mode and --authentication-account. Follow AuthenticationArguments into AppInstaller::Authenticator and Authentication::AuthenticateForToken. Done means the external token can be supplied through the CLI and COM API and is returned by AuthenticateForToken when present.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api, authentication, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.