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

NuGet won't authenticate with server on Linux #6876

Open
dasjestyr opened this issue Apr 28, 2018 · 6 comments
Open

NuGet won't authenticate with server on Linux #6876

dasjestyr opened this issue Apr 28, 2018 · 6 comments
Labels
Area:Authentication Platform:Mono NuGet.exe on mono scenarios Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Status:Excluded from icebox cleanup Status:Inactive Icebox issues not updated for a specific long time Type:Bug

Comments

@dasjestyr
Copy link

dasjestyr commented Apr 28, 2018

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe):
NuGet.exe

NuGet version (x.x.x.xxx):
4.6.2.5055 (via mono) and 2.8.6 (via apt-get)

dotnet.exe --version (if appropriate):
n/a

VS version (if appropriate):
n/a

OS version (i.e. win10 v1607 (14393.321)):
Description: Ubuntu 18.04 LTS (bionic)

Worked before? If so, with which NuGet version:
3.4.3.855 (windows)

Detailed repro steps so we can see the same problem

  1. Install mono. Download latest NuGet.exe. Run nuget commands to add sources:
    mono nuget.exe sources add -name FEED_NAME -source <feed url> -UserName<username> -Password"<password>"

  2. Try to run mono nuget.exe list -source FEED_NAME
    Response is 401 and thus prompts for username/password. All credentials fail.

...

Other suggested things

  • Did the same with apt package with mostly the same results when trying to list packages
    -- when run with mono, I always get prompted for username/password but they always fail
    -- when run with the apt-get package (2.8), I get "warning: no access to the given key" followed by "no packages found".
  • Did the exact same thing on windows. I still got the prompt, but after manually entering creds, it would list packages (success).
  • Windows case is odd because the creds should be stored and sent up automatically. Linux case is odd because the creds are known to be working but always fail.
  • Using MyGet enterprise account

Verbose Logs

Please include verbose logs (NuGet.exe -verbosity detailed | dotnet.exe --verbosity diag | etc...)

draepetan@bamboo-main:/usr/lib/nuget$ mono nuget.exe list -source DAS_MyGet -verbosity detailed
NuGet Version: 4.6.2.5055
Using credentials from config. UserName: build
The remote server indicated that the previous request was forbidden. Please provide credentials for: https://airstrike.myget.org/F/dasdevelopment/api/v3/index.json
UserName: build
Password: ************
Please provide credentials for: https://airstrike.myget.org/F/dasdevelopment/api/v3/index.json
UserName:

Sample Project

n/a

@dasjestyr dasjestyr changed the title NuGet won't authenticate with server NuGet won't authenticate with server on Linux Apr 28, 2018
@PatoBeltran
Copy link

@nkolev92 is this a known issue with auth in mono?

@PatoBeltran PatoBeltran added Area:Authentication Platform:Mono NuGet.exe on mono scenarios labels May 1, 2018
@nkolev92
Copy link
Member

nkolev92 commented May 1, 2018

Not aware of any specific issues.

It seems like an issue with the specific credential provider.
The console prompting is done by NuGet itself as an absolute last option.

NuGet itself doesn't prompt but it defers to the credential provider itself.

I'd guess it's one of the following 2:

  • The credential provider is not on disk, and/or NuGet can't find it.
  • The credential provider returns null credentials to NuGet, so NuGet just falls back to the default console prompting.

@amatiasq
Copy link

amatiasq commented Sep 27, 2019

No update?

I've added my feed to nuget and works in a macOS and a Windows machine but not on the Linux build server.

nuget sources Add -Name "myFeed" -Source "https://pkgs.dev.azure.com/hi/_packaging/censoring/nuget/v3/index.json" -UserName random_irrelevant_name -Password not-pasting-it

But when I try to fetch

user@server:~$ nuget list -Source myFeed
WARNING: No access to the given key
No packages found.

While if I run this in macOS or Windows it works and returns packages. On windows it asks for credentials every time though.

UPDATE: I tried a symbolic link I found in some stack overflow

ln -s ~/.nuget/NuGet ~/.config/Nuget

Now it outputs this:

user@server:~$ nuget list -Source myFeed
Using credentials from config. UserName: random_irrelevant_name
WARNING: The remote server returned an error: (404) Not Found.
No packages found.

Again, this doesn't give 404 on macOS or Windows.

@larsjr
Copy link

larsjr commented Nov 12, 2019

Have you tried using a feed to NuGet 2? I had a very similar problem, and I resolved it by using nuget/v2 instead of nuget/v3/index.json. Your feed might not support it, but perhaps worth a try. So in your case, you should use

nuget sources Add -Name "myFeed" -Source "https://pkgs.dev.azure.com/hi/_packaging/censoring/nuget/v2" -UserName random_irrelevant_name -Password not-pasting-it

@nkolev92
Copy link
Member

@larsjr V2 feeds are significantly slower than V3 feeds.

I wouldn't normally expect that to make a difference.

@zkat zkat added Type:Bug Priority:2 Issues for the current backlog. labels Apr 16, 2020
@nkolev92
Copy link
Member

Looking at this issue again it's probably related to #2869.

@nkolev92 nkolev92 added Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. and removed Priority:2 Issues for the current backlog. Pipeline:New Issues labels Apr 17, 2020
@ghost ghost added the Status:Inactive Icebox issues not updated for a specific long time label Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Authentication Platform:Mono NuGet.exe on mono scenarios Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Status:Excluded from icebox cleanup Status:Inactive Icebox issues not updated for a specific long time Type:Bug
Projects
None yet
Development

No branches or pull requests

8 participants