Cannot access Azure DevOps feed using the PAT token
- Dominant language
- C#
- Stars
- 11.5k
- Forks
- 960
- PR merge metrics
- No merged PRs in 30d
Description
### What You Are Seeing?
When I try to consume packages from a Azure DevOps feed, hosted internally, I get error : "Invalid credentials specified"
### What is Expected?
To be able to list the packages from the feed.
### How Did You Get This To Happen? (Steps to Reproduce)
choco list --source="URL" -u USER -p PAT
INFO:
Problems can be related to the NTLM authentication.
It seems that chocolatey/nuget.core tries to do the authentication using the domain user instead of the user and token provided.
If I add the domain user to the Azure DevOps it works. I need to be able to login with credentials as PAT of an existing user.
### Output Log
Full Log Output
SourceType='normal'|Debug='False'|Verbose='False'|Trace='False'|
Force='False'|Noop='False'|HelpRequested='False'|
UnsuccessfulParsing='False'|RegularOutput='True'|QuietOutput='False'|
PromptForConfirmation='True'|AcceptLicense='False'|
AllowUnofficialBuild='False'|Input='chocolate-license'|
AllVersions='False'|SkipPackageInstallProvider='False'|
Prerelease='False'|ForceX86='False'|OverrideArguments='False'|
NotSilent='False'|ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|Information.PlatformType='Windows'|
Information.PlatformVersion='10.0.14393.0'|
Information.PlatformName='Windows 10'|
Information.ChocolateyVersion='0.10.15.0'|
Information.ChocolateyProductVersion='0.10.15'|
Information.FullName='choco, Version=0.10.15.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|
Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='True'|
Information.UserName='USER'|Information.UserDomainName='DOMAIN'|
Information.IsUserAdministrator='True'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='False'|
Information.IsUserRemote='True'|
Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
Information.CurrentDirectory='C:\WINDOWS\system32'|
Features.AutoUninstaller='True'|Features.ChecksumFiles='True'|
Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.LogWithoutColor='False'|
Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseEnhancedExitCodes='False'|
Features.UseFipsCompliantChecksums='False'|
Features.ShowNonElevatedWarnings='True'|
Features.ShowDownloadProgress='True'|
Features.StopOnFirstPackageFailure='False'|
Features.UseRememberedArgumentsForUpgrades='False'|
Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'|
Features.SkipPackageUpgradesWhenNotInstalled='False'|
Features.RemovePackageInformationOnUninstall='False'|
Features.ExitOnRebootDetected='False'|
Features.LogValidationResultsOnWarnings='True'|
Features.UsePackageRepositoryOptimizations='True'|
Features.ScriptsCheckLastExitCode='False'|
ListCommand.LocalOnly='False'|
ListCommand.IdOnly='False'|ListCommand.IncludeRegistryPrograms='False'|
ListCommand.PageSize='25'|ListCommand.Exact='False'|
ListCommand.ByIdOnly='False'|ListCommand.ByTagOnly='False'|
ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='False'|
ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|
ListCommand.IncludeVersionOverrides='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
SourceCommand.AllowSelfService='False'|
SourceCommand.VisibleToAdminsOnly='False'|
FeatureCommand.Command='unknown'|ConfigCommand.Command='unknown'|
ApiKeyCommand.Remove='False'|PinCommand.Command='unknown'|
OutdatedCommand.IgnorePinned='False'|Proxy.BypassOnLocal='True'|
2020-10-27 10:22:05,931 9148 [DEBUG] - _ Chocolatey:ChocolateyListCommand - Normal Run Mode _
2020-10-27 10:22:05,931 9148 [DEBUG] - Searching for package information
2020-10-27 10:22:05,946 9148 [DEBUG] - Running list with the following filter = 'chocolate-license'
2020-10-27 10:22:05,946 9148 [DEBUG] - --- Start of List ---
2020-10-27 10:22:07,025 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:07,025 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:07,259 9148 [WARN ] - Invalid credentials specified.
2020-10-27 10:22:07,259 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:07,259 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:07,493 9148 [WARN ] - Invalid credentials specified.
2020-10-27 10:22:07,493 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:07,493 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:07,743 9148 [WARN ] - Invalid credentials specified.
2020-10-27 10:22:07,743 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:07,743 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:07,993 9148 [WARN ] - Invalid credentials specified.
2020-10-27 10:22:07,993 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:07,993 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:08,259 9148 [WARN ] - Invalid credentials specified.
2020-10-27 10:22:08,259 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:08,259 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:14,665 9148 [WARN ] - Invalid credentials specified.
2020-10-27 10:22:14,665 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:14,665 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:15,009 9148 [WARN ] - Invalid credentials specified.
2020-10-27 10:22:15,009 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:15,009 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:15,259 9148 [WARN ] - [NuGet] Not able to contact source 'URL/_packaging/Deployments/nuget/v2'. Error was The remote server returned an error: (401) Unauthorized.
2020-10-27 10:22:15,509 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:15,509 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:15,743 9148 [WARN ] - Invalid credentials specified.
2020-10-27 10:22:15,743 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:15,743 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:15,978 9148 [WARN ] - Invalid credentials specified.
2020-10-27 10:22:15,978 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:15,978 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:16,212 9148 [WARN ] - Invalid credentials specified.
2020-10-27 10:22:16,212 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:16,212 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:16,446 9148 [WARN ] - Invalid credentials specified.
2020-10-27 10:22:16,446 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:16,446 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:16,681 9148 [WARN ] - Invalid credentials specified.
2020-10-27 10:22:16,696 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:16,696 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:16,962 9148 [WARN ] - Invalid credentials specified.
2020-10-27 10:22:16,962 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:16,962 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:17,275 9148 [WARN ] - Invalid credentials specified.
2020-10-27 10:22:17,290 9148 [DEBUG] - Attempting to gather credentials for 'URL/_packaging/Deployments/nuget/v2'
2020-10-27 10:22:17,290 9148 [DEBUG] - Using saved credentials
2020-10-27 10:22:17,540 9148 [WARN ] - [NuGet] Not able to contact source 'URL/_packaging/Deployments/nuget/v2'. Error was The remote server returned an error: (401) Unauthorized.
2020-10-27 10:22:17,806 9148 [DEBUG] - --- End of List ---
2020-10-27 10:22:17,806 9148 [WARN ] - 0 packages found.
2020-10-27 10:22:17,806 9148 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2020-10-27 10:22:17,821 9148 [DEBUG] - Exiting with 0
2020-10-27 10:22:34,462 5108 [DEBUG] - XmlConfiguration is now operational
Contributor guide
Research direction
Start with the choco list command and the NuGet credential-handling path described in the log. Reproduce against an internally hosted Azure DevOps feed using a PAT instead of the domain user, then trace the repeated 401 responses. Done means the supplied user and PAT can authenticate and list packages without adding the domain user.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- authentication, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100