Description
In order to allow installing private packages Yarn will need to send a token to the headers of the request.
Private packages are @scoped/packages
that were published with npm publish --access=restricted
. The permissions of packages are managed through npm access
and npm team
which are not yet added
In the npm client, this token comes from the .npmrc
and looks like this:
@nameofscope:registry=https://registry.npmjs.com/
//registry.npmjs.com/:_authToken=abc123
And it gets sent as this header:
Authorization: Bearer abc123
# alternatively:
Authorization: Basic username:password # <= base64
There's a package for retrieving the token. Although we may not want to store the token the same way npm does.
This token gets added to .npmrc
on npm login
. But yarn login
doesn't even authenticate (it only stores username and email), so we may want to force the user to authenticate on install (in which case we need to solve scripting these installs for CI servers through some kind of environment variable).
We also need to make sure that Yarn users don't accidentally publish something publicly.