support for CREDENTIALPROVIDERS for nuget in LinqPad

I am using VSTS package feed for my project and it requires custom credential provider for nuget feed authentication.
I tried putting VSTS Credential Provider at LinqPAd/nuget but it is not working. I doubt if LinqPad has support for it. can some one confirm if it is supported then how to configure it ?

FYI - for general info on credential provider http://docs.nuget.org/ndocs/api/credential-providers#using-a-credential-provider-from-an-environment-variable

Comments

  • LINQPad doesn't support VSTS authentication right now. Have you tried creating a personal access token?

    https://www.visualstudio.com/en-us/docs/setup-admin/team-services/use-personal-access-tokens-to-authenticate
  • I tried that but that is not working. Any idea where LinqPad stores PAT after configuring ?
  • LINQPad feeds your proxy credentials to the NuGet library using the following code:
    static void SetupProxy ()
    {
    	if (_proxySetupDone) return;
    	_proxySetupDone = true;
    
    	// Set up proxy handling for v3 sources.
    	// We need to sync the v2 proxy cache and v3 proxy cache so that the user will not
    	// get prompted twice for the same authenticated proxy.
    	var v2ProxyCache = global::NuGet.ProxyCache.Instance as IProxyCache;
    
    	global::NuGet.Protocol.Core.v3.HttpHandlerResourceV3.PromptForProxyCredentials = (uri, proxy, cancellationToken) =>
    	{
    		var v2Credentials = v2ProxyCache?.GetProxy (uri)?.Credentials;
    		if (v2Credentials != null && proxy.Credentials != v2Credentials)
    		{
    			// if cached v2 credentials have not been used, try using it first.
    			return Task.FromResult (v2Credentials);
    		}
    
    		return Task.FromResult (GetProxyCredentials());
    	};
    
    	global::NuGet.Protocol.Core.v3.HttpHandlerResourceV3.ProxyPassed = proxy =>
    	{
    		// add the proxy to v2 proxy cache.
    		v2ProxyCache?.Add (proxy);
    	};
    }
    In addition, it populates the http_proxy environment variable before calling NuGet.Core library features such as search (crazy, I know, but that's the only way I know to get it to use a web proxy.)
  • Any clue when this issues will be fixed? I trued couldnt get this to work :(
  • Joe, is there any chance you may give this issue a lift?

    I feel like I'm in a constant crazy loop that forces me to download new internal packages from VSTS into a folder in order to be able to use my lovely tool LinqPad.

    Is there any chance you can give us a way to make this work?

    Thanks in advance
  • Per this SO post, change the end of your feed URL to /v2. Then create a Personal Access Token and put it into both the username and password fields. Works here. HTH
  • While using this advice allowed me to see the content of my VSTS feed in LINQPad's package manager, it gave an error when I'm trying to add a package to the query. Also, when I try to access the feed again after re-opening the package manager window, it won't show again with "TF400813: Resource not available for anonymous access. Client authentication required." message.
    Looks like LINQPad only uses the provided credentials once and then stops passing them.
  • I'm having the same problem. /v3 and /v2 suggestion both work, but ONLY when the VSTS Nuget source is the ONLY one in the list. If there's a second one and I'm switching between them, then I get the TF400813 error.
  • +1 This is really frustrating
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!