Skip to content
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

dotnet restore does not prompt for user input when authenticating #2887

Closed
alpaix opened this issue Jun 2, 2016 · 14 comments
Closed

dotnet restore does not prompt for user input when authenticating #2887

alpaix opened this issue Jun 2, 2016 · 14 comments
Labels
Area:Authentication Platform:Xplat Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. WaitingForCustomer Applied when a NuGet triage person needs more info from the OP
Milestone

Comments

@alpaix
Copy link

alpaix commented Jun 2, 2016

The Problem

When using a Nuget repository that requires authentication, dotnet restore fails with a 401 Unauthorized unless the password is provided in cleartext in the Nuget config file.

However, having cleartext passwords in the config file isn't great, and with the original (non-dotnet) workflow, if there were no passwords in the config file, "nuget restore" on the command line would prompt for username/password credentials. Doing a nuget restore from within VS2015 would pop up a dialog box asking for username/password credentials as well.

Running "dotnet restore" does not prompt for any credentials at all, but just instantly fails after getting the 401 Unauthorized. This is also the case when restoring within a VS2015 ".NET Core" project - no credential dialog appears.

Expected behavior

If the Nuget repository requires authentication and there are no credentials in the config file, "dotnet restore" should prompt for credentials when run from the command line or from within VS2015, the same way that "nuget restore" does.

Actual behavior

"dotnet restore" does not prompt for credentials and just fails with 401 Unauthorized.

Environment data

dotnet --info output:
.NET Command Line Tools (1.0.0-preview1-002702)

Product Information:
Version: 1.0.0-preview1-002702
Commit Sha: 6cde212

Runtime Environment:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x64

I'm using NuGet version 3.4.3.855.

@alpaix
Copy link
Author

alpaix commented Jun 2, 2016

Reported in https://github.com/dotnet/cli/issues/3097.

Currently NuGet XPlat doesn't support interactive scenario. Need to verify what was the issue blocking it.

@lszomoru
Copy link

Any updates on this? Thanks!

@alpaix
Copy link
Author

alpaix commented Jun 23, 2016

//cc @rrelyea @yishaigalatzer @emgarten for triage

@lszomoru
Copy link

lszomoru commented Aug 4, 2016

Apologies for the nudge but any update on this? Thanks!

@emgarten
Copy link
Member

emgarten commented Aug 4, 2016

@lszomoru is there a specific scenario you have where entering the credentials in manually is needed instead of using a config file?

@lszomoru
Copy link

lszomoru commented Aug 5, 2016

At the moment I am working on a .NET Core project in which I am trying to use multiple private packages that are being stored in VSTS. If my understanding is correct, the only way to get "dotnet restore" to work is to create a personal access token and store this personal access token as clear text in the nuget.config file. I think that the end goal should be to get "dotnet restore" to work the same way as "nuget restore" which just works with packages stored in private feeds. thanks!

@mohamedmansour
Copy link

mohamedmansour commented Sep 28, 2016

The issue is that your authentication failed. If you do the following:

nuget.exe sources Add -Name "SomeFeed" -Source "your nuget feed" -Username someuser -password somepassword -StorePasswordInClearText

Then it will work. Perhaps better error messaging is needed, and should allow us to popup authentication.

@mohamedmansour
Copy link

What should be done to help developers, in the meantime. Add proper logging messages for this:

Cannot authenticate to 'SomeFeed', please run this command to re-authenticate:

nuget.exe sources Add -Name "SomeFeed"
nuget.exe sources Add -Name "SomeFeed" -Source "your nuget feed" -Username someuser -password somepassword -StorePasswordInClearText

@evil-shrike
Copy link

The problem is that also that .NET SDK doesn't contain nuget.exe. So after I've installed the SDK I can't install any package from my internal feed.

@emgarten emgarten added this to the Backlog milestone Nov 30, 2017
@JoseFMP
Copy link

JoseFMP commented Feb 5, 2018

Any news here? This is a terrible bug... so if the nuget gallery requires authentication... nothing that we can do?!

@anangaur
Copy link
Member

anangaur commented Feb 5, 2018

Related #6486. We are looking into this issue and early discussion in this regard is taking place. Do monitor this thread for more info in future. (You may also want to subscribe to #6486)

@samedder
Copy link

Hey, reviving this issue since it seems like a pretty big blocker for CI/CD systems. Is anyone actively working on this or has it be relegated to wont fix?

@nkolev92 nkolev92 changed the title dotnet restore does not prompt for authentication dotnet restore does not prompt for user input when authenticating Jun 11, 2018
@nkolev92
Copy link
Member

The way I read this, the original ask talks about the action of prompting the user on the commandline to enter credentials to authenticate.

As @anangaur already mentioned in #6486 we will solve the problem for dotnet.exe authentication by introducing a new plugin model.
This would enable people to use feeds like VSTS (and any other feed providers, that would be able to write their own provider).

The way this will work is via device flow authentication.
dotnet.exe would print out a link and a token that a user would need to go to and complete the authentication. Once that's done, the credential provider will present NuGet with a PAT that will be used for all the other operations.

Is there a scenario in which prompting at the commandline would be favored over just adding those credentials in the config/allowing the credential plugin to do it's thing to authenticate you?

Personally I'd like us to close this issue as duplicate/won't fix to #6486

@nkolev92 nkolev92 added WaitingForCustomer Applied when a NuGet triage person needs more info from the OP Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. labels Jun 11, 2018
@nkolev92
Copy link
Member

nkolev92 commented Jul 5, 2018

Per the above comment.

Closing this as won't fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Authentication Platform:Xplat Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. WaitingForCustomer Applied when a NuGet triage person needs more info from the OP
Projects
None yet
Development

No branches or pull requests

9 participants