New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nuget.exe push/delete won't use API Key #2627

Closed
spadapet opened this Issue Apr 20, 2016 · 9 comments

Comments

Projects
None yet
8 participants
@spadapet

spadapet commented Apr 20, 2016

Using version 3.4.3.854

REPRO

  • Start with the default nuget.config file in %appdata%\nuget that only has nuget.org as a source
  • In a browser, log into your nuget.org account and follow the instructions to set an apikey:
  • nuget.exe setApiKey XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  • Try to unlist one of your packages:
  • Example 1: nuget.exe delete foo 99.99 -Source nuget.org
  • Example 2: nuget.exe push foo.nupkg -Source nuget.org

RESULT
WARNING: No API Key was provided and no API Key could be found for 'https://www.nuget.org/api/v2/package'. To save an API Key for a source use the 'setApiKey' command.

EXPECT
I already did set the API Key according to the instructions. Unlisting works fine if I set the API Key for https://www.nuget.org/api/v2/package, but why do I need to do that?

NOTE
Same issue with myget.org

@yishaigalatzer

This comment has been minimized.

Show comment
Hide comment
@yishaigalatzer

yishaigalatzer Apr 21, 2016

@spadapet is this a regression?

yishaigalatzer commented Apr 21, 2016

@spadapet is this a regression?

@spadapet

This comment has been minimized.

Show comment
Hide comment
@spadapet

spadapet Apr 21, 2016

I tried the previous version (3.3.0.212) and it fails for an even more bizarre reason:

> nuget3.exe delete MyTestPackageX 2.0.2 -Source nuget.org
WARNING: No API Key was provided and no API Key could be found for 'https://api.nuget.org/v3/index.json'. To save an API Key for a source use the 'setApiKey' command.
Deleting MyTestPackageX 2.0.2 from the 'https://api.nuget.org/v3/index.json'.
Failed to process request. 'HTTP Version Not Supported'.
The remote server returned an error: (505) Http Version Not Supported..

Looks like this:

image

And then if I add the API Key for https://api.nuget.org/v3/index.json, it still fails:

image

So, the behavior is sort of better now since I can actually unlist. But I need to know to set the API Key for a specific packages URL

spadapet commented Apr 21, 2016

I tried the previous version (3.3.0.212) and it fails for an even more bizarre reason:

> nuget3.exe delete MyTestPackageX 2.0.2 -Source nuget.org
WARNING: No API Key was provided and no API Key could be found for 'https://api.nuget.org/v3/index.json'. To save an API Key for a source use the 'setApiKey' command.
Deleting MyTestPackageX 2.0.2 from the 'https://api.nuget.org/v3/index.json'.
Failed to process request. 'HTTP Version Not Supported'.
The remote server returned an error: (505) Http Version Not Supported..

Looks like this:

image

And then if I add the API Key for https://api.nuget.org/v3/index.json, it still fails:

image

So, the behavior is sort of better now since I can actually unlist. But I need to know to set the API Key for a specific packages URL

@spadapet

This comment has been minimized.

Show comment
Hide comment
@spadapet

spadapet Apr 21, 2016

Ah, it is a regression from nuget.exe 2.8.60717.93.

  • nuget2.exe setApiKey [my key]
  • nuget2.exe delete mytestpackagex 2.0.2

Works fine

image

spadapet commented Apr 21, 2016

Ah, it is a regression from nuget.exe 2.8.60717.93.

  • nuget2.exe setApiKey [my key]
  • nuget2.exe delete mytestpackagex 2.0.2

Works fine

image

@spadapet spadapet changed the title from nuget.exe delete won't use API Key for nuget.org to nuget.exe push/delete won't use API Key for nuget.org May 12, 2016

@zhili1208

This comment has been minimized.

Show comment
Hide comment
@zhili1208

zhili1208 Jun 14, 2016

Contributor

the issue here is
nuget.exe setApiKey [mykey]
the default apikey config is key ="https://www.nuget.org", value =[mykey]
nuget.exe delete mytestpackagex 2.0.2
nuget try to find value of key "https://www.nuget.org/api/v2/package" in nuget.config, it return null.

Contributor

zhili1208 commented Jun 14, 2016

the issue here is
nuget.exe setApiKey [mykey]
the default apikey config is key ="https://www.nuget.org", value =[mykey]
nuget.exe delete mytestpackagex 2.0.2
nuget try to find value of key "https://www.nuget.org/api/v2/package" in nuget.config, it return null.

@jmyersmsft

This comment has been minimized.

Show comment
Hide comment
@jmyersmsft

jmyersmsft Jun 14, 2016

Whether or not this is the same root cause as #2975 , that bug is not just a problem of inconsistent defaults, and it's not just a problem for nuget.org.

jmyersmsft commented Jun 14, 2016

Whether or not this is the same root cause as #2975 , that bug is not just a problem of inconsistent defaults, and it's not just a problem for nuget.org.

@zhili1208

This comment has been minimized.

Show comment
Hide comment
@zhili1208

zhili1208 Jun 14, 2016

Contributor

@jmyersmsft yes, this is not a problem for nuget.org, it's for all sources

Contributor

zhili1208 commented Jun 14, 2016

@jmyersmsft yes, this is not a problem for nuget.org, it's for all sources

@zhili1208 zhili1208 changed the title from nuget.exe push/delete won't use API Key for nuget.org to nuget.exe push/delete won't use API Key Jun 14, 2016

@rrelyea rrelyea modified the milestones: 3.5 Beta3, 3.5 RC Jun 14, 2016

@rrelyea

This comment has been minimized.

Show comment
Hide comment
@rrelyea

rrelyea Jun 14, 2016

Contributor

Zhi found several dupes. Putting in beta3 for analysis.

Contributor

rrelyea commented Jun 14, 2016

Zhi found several dupes. Putting in beta3 for analysis.

@zhili1208 zhili1208 assigned zhili1208 and unassigned spadapet Jun 14, 2016

@alpaix alpaix self-assigned this Jul 5, 2016

alpaix added a commit to NuGet/NuGet.Client that referenced this issue Jul 15, 2016

Fixed reading apiKey from nuget.config
Changed API Key lookup by allowing searching by endpoint first, then by
source url, and in case of nuget.org by default gallery url.
Added functional tests for some of the scenarios.

Fixes NuGet/Home#2627.
@wallism

This comment has been minimized.

Show comment
Hide comment
@wallism

wallism Jan 27, 2017

I had the same issue today on v3.4.3.855.
I set the api key using the required command, then when I ran the push I got this warning:

WARNING: No API Key was provided and no API Key could be found for 'https://www.nuget.org/api/v2/package'

and was asked to login using username and password.

So the issue for me was, when I ran: nuget SetApiKey abc...def, I noticed that in the config file ("%Appdata%\Roaming\Nuget\NuGet.Config") it added a key for https://www.nuget.org, when I changed to to the full path it worked fine -> https://www.nuget.org/api/v2/package

So the bug appears to be in the SetApiKey command, not setting the correct key (for the push case anyway)

wallism commented Jan 27, 2017

I had the same issue today on v3.4.3.855.
I set the api key using the required command, then when I ran the push I got this warning:

WARNING: No API Key was provided and no API Key could be found for 'https://www.nuget.org/api/v2/package'

and was asked to login using username and password.

So the issue for me was, when I ran: nuget SetApiKey abc...def, I noticed that in the config file ("%Appdata%\Roaming\Nuget\NuGet.Config") it added a key for https://www.nuget.org, when I changed to to the full path it worked fine -> https://www.nuget.org/api/v2/package

So the bug appears to be in the SetApiKey command, not setting the correct key (for the push case anyway)

@emgarten

This comment has been minimized.

Show comment
Hide comment
@emgarten

emgarten Jan 27, 2017

Contributor

@wallism get the latest nuget.exe 3.5.0 here: http://dist.nuget.org/index.html

If you are still seeing the bug open a new issue to track this.

Contributor

emgarten commented Jan 27, 2017

@wallism get the latest nuget.exe 3.5.0 here: http://dist.nuget.org/index.html

If you are still seeing the bug open a new issue to track this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment