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

[Bug] Invalid authentication (as an unknown user) with Azure Devops Artifacts #1442

Closed
1 task
IT-CASADO opened this issue Jun 4, 2020 · 3 comments
Closed
1 task
Labels
bug Something isn't working

Comments

@IT-CASADO
Copy link

IT-CASADO commented Jun 4, 2020

  • I'd be willing to implement a fix

Describe the bug

I'm desperately trying to use Yarn 2 with a private repository from Azure Devops Artifacts.
But I'm always getting an error "Invalid authentication (as an anonymous user)"

To Reproduce

My package.json

{
	"name": "yarn2",
	"version": "1.0.0",
	"main": "index.js",
	"author": "Daniel Casado",
	"license": "MIT",
	"devDependencies": {
		"@casado/casado.editor-config": "^1.0.0"
	}
}

and .yamlrc.yml

npmScopes:
  "casado":
    npmAlwaysAuth: true
    npmRegistryServer: "https://pkgs.dev.azure.com/it-casado/apps/_packaging/casado/npm/registry"
    npmAuthToken: "MY_TOKEN_AS_BASE64"

yarnPath: ".yarn/releases/yarn-berry.js"

Note: The provided token is a read-only token to a testing repository!

I also tryied:

npmScopes:
  "casado":
    npmAlwaysAuth: true
    npmRegistryServer: "https://pkgs.dev.azure.com/it-casado/apps/_packaging/casado/npm/registry"
    npmAuthIdent: "ANY_USERNAME:MY_TOKEN_AS_BASE64"

yarnPath: ".yarn/releases/yarn-berry.js"

This token is working under NPM abd Yarn V1 (with .npmrc).

always-auth=true
@casado:registry=https://pkgs.dev.azure.com/it-casado/apps/_packaging/casado/npm/registry/

//pkgs.dev.azure.com/it-casado/apps/_packaging/casado/npm/registry/:username=it-casado
//pkgs.dev.azure.com/it-casado/apps/_packaging/casado/npm/registry/:_password=MY_TOKEN_AS_BASE64

Environment if relevant (please complete the following information):

  • OS: [Windows.]
  • Node version [12.17.0]
  • Yarn version [2.0.0-rc.33]

See also
Azure Artifacts - Set up your client's npmrc

@IT-CASADO IT-CASADO added the bug Something isn't working label Jun 4, 2020
@IT-CASADO
Copy link
Author

I found the solution on this issue #316:

So, after encoding <username>:<raw PAT> as base64, and putting that in the npmAuthIdent, I successfully authenticate with the server. So now ...

I only tried : for npmAuthIdent, but that doesn't work.

@manuel-mauky
Copy link

I found the solution on this issue #316:

So, after encoding <username>:<raw PAT> as base64, and putting that in the npmAuthIdent, I successfully authenticate with the server. So now ...

I only tried : for npmAuthIdent, but that doesn't work.

This info would be super helpful in the documentation of npmAuthIdent

@marksy
Copy link
Contributor

marksy commented Sep 1, 2023

I spent hours trying to get yarn 3 to auth with Azure and finally found this thread, which provided a solution ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants