microsoft / artifacts-credprovider

The Azure Artifacts Credential Provider enables dotnet, NuGet.exe, and MSBuild to interactively acquire credentials for Azure Artifacts feeds.
MIT License
747 stars 709 forks source link

The proxy tunnel request to proxy failed with status code '407' #495

Open solarding opened 2 months ago

solarding commented 2 months ago

Using a very restricted Laptop, behind Proxy (no way to change the winhttp proxy ) I got this error, there is no way for interactive authenticate

PS C:\Users\abc\source\xRM_API\xRM> dotnet nuget push --skip-duplicate --interactive --source https://pkgs.dev.azure.com/xxxx/_packaging/xRM/nuget/v3/index.json --api-key AZ xxxx.nupkg

error: [CredentialProvider]Failed to acquire session token: System.Net.Http.HttpRequestException: The proxy tunnel request to proxy 'http://web-proxy.snb.zz:8080/' failed with status code '407'."

error: at System.Net.Http.HttpConnectionPool.EstablishProxyTunnelAsync(Boolean async, HttpRequestHeaders headers, CancellationToken cancellationToken)

error: at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)

error: at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)

error: at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)

error: at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)

error: at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)

error: at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)

error: at System.Net.Http.AuthenticationHelper.SendWithAuthAsync(HttpRequestMessage request, Uri authUri, Boolean async, ICredentials credentials, Boolean preAuthenticate, Boolean isProxyAuth, Boolean doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken)

error: at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)

error: at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)

error: at NuGetCredentialProvider.CredentialProviders.Vsts.AuthUtil.GetResponseHeadersAsync(Uri uri, CancellationToken cancellationToken) in D:\a_work\1\s\CredentialProvider.Microsoft\CredentialProviders\Vsts\IAuthUtil.cs:line 147

error: at NuGetCredentialProvider.CredentialProviders.Vsts.AuthUtil.GetAadAuthorityUriAsync(Uri uri, CancellationToken cancellationToken) in D:\a_work\1\s\CredentialProvider.Microsoft\CredentialProviders\Vsts\IAuthUtil.cs:line 55

error: at NuGetCredentialProvider.CredentialProviders.Vsts.VstsCredentialProvider.HandleRequestAsync(GetAuthenticationCredentialsRequest request, CancellationToken cancellationToken) in D:\a_work\1\s\CredentialProvider.Microsoft\CredentialProviders\Vsts\VstsCredentialProvider.cs:line 99

error: at NuGetCredentialProvider.RequestHandlers.GetAuthenticationCredentialsRequestHandler.HandleRequestAsync(GetAuthenticationCredentialsRequest request) in D:\a_work\1\s\CredentialProvider.Microsoft\RequestHandlers\GetAuthenticationCredentialsRequestHandler.cs:line 82

error: Der Dienstindex für die Quelle https://pkgs.dev.azure.com/xxxxx/_packaging/xRM/nuget/v3/index.json konnte nicht geladen werden.

error: Response status code does not indicate success: 401 (Unauthorized).

embetten commented 1 week ago

The http client should be sending the default credentials on the above logged call - does the proxy require alternate credentials than default?

Additionally, is this a windows machine? Can you provide more information on the OS being used?