-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Yarn doesn't provide authorization header to download private package #3433
Comments
I made some more checks, and bug is caused by the Verdaccio configuration: When Yarn goes back to the getAuth function, it search a config with the key "//127.0.0.1:4873/:_authToken", with doesn't exist (only //localhost:4873/:_authToken fails). A good solution would be to resolve the authorization header once per package, and keep using it until full package download. On yarn 0.26 (master), you need to set the "always-auth" config option to true to make it work. |
@Congelli501, what would be the next action then? |
Closing due to lack of response. @Congelli501, feel free to reopen with next steps and we'll get the discussion rolling. |
Hi, I started encountering the same problem last week. Any solutions to this? |
This doesn't seem to work even though the URL is resolved properly |
(sorry for the necrobump) @prasannamestha the workaround is to set the "always-auth" setting to true as documented above. If you read the code, it's actually pretty easy to see the bug. From https://github.com/yarnpkg/yarn/blob/v1.22.22/src/registries/npm-registry.js#L164: if (this.token || (isToRegistry && (alwaysAuth || this.isScopedPackage(packageIdent)))) {
const authorization = this.getAuth(packageIdent);
if (authorization) {
headers.authorization = authorization;
}
} If the package isn't scoped, then you need to set |
Type: bug
What is the current behavior?
When using the Verdaccio private npm registry, yarn fail to install a package. It fires a first request to get the packages version & meta, which is authenticated and works.
Then it issues a second request to download the tgz file, which fails, as the request is not authenticated.
On the other hand, npm does the same first request and successfully install the package by authenticating the second request.
You can see included http request dump for more detail.
If the current behavior is a bug, please provide the steps to reproduce.
Install Verdaccio with a test user, on localhost:4873
Init
Publish a test project
mkdir hello12 yarn init yarn publish # Ok
Create an other test project
Try to install the hello12 dep, with Yarn
Command
List package info
Get data request
Install the hello12 dep, with NPM
Command
List package info
Get package
What is the expected behavior?
Yarn should act as NPM and send the authorization header to download the tgz file
Versions
OS: Ubuntu 16.04 + updates
Arch: amd64
Node: v7.10.0
Yarn: v0.24.5 (also tested with v0.25.2)
NPM: 4.2.0
The text was updated successfully, but these errors were encountered: