microsoft / microsoft/winget-cli
Allow passing an external authentication token override instead of using the builtin authentication handler
Nobody has claimed this yet.
- 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:
WebAuthenticationCoreManagerhas bugs involving running programs as different users (#6186). This can be worked around when usingWebAuthenticationCoreManagerdirectly 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 builtinWebAuthenticationCoreManagerflow.- 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 silentis 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
AuthenticationAccountwithString AuthenticationToken;. - Extend the CLI interface with
--authentication-tokenakin to--authentication-modeand--authentication-account. - Pass both values to
AppInstaller::Authenticatoras part of theAuthenticationArguments. - Adjust
AppInstaller::Authentication::AuthenticateForTokento return the token from the authentication arguments, if present.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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