Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
npm publish is unauthorized
-
Hello.
Despite following the instructions here, I get a 401 error when trying to publish an NPM package using an API key. Is this possible?
Kind regards,
David.
-
Are you able to pull successfully using npm and ProGet? Also, does your API Key have the Feed API right enabled or if you are impersonating a user, does that user have the ability to publish packages?
Also, when you set your NPM auth using:
[~]$ npm config set always-auth=true [~]$ npm config set _auth={ENCODEDAPIKEY}
Are you base64 encoding your API Key using the format
api:{APIKEY}
. For example:If my API key is
FakeApiKey
, I would want to base 64 encodeapi:FakeApiKey
would beYXBpOkZha2VBcGlLZXk=
. So the commands to run would be:[~]$ npm config set always-auth=true [~]$ npm config set _auth=YXBpOkZha2VBcGlLZXk=
Alternatively, you could use
npm adduser
to login. Here are some examples:If you ran the command to make ProGet your default repo:
npm adduser --always-auth
If you are using multiple repos:npm adduser --registry=http://progetrepo/feedname --always-auth
If you are using scoped repos:npm adduser --registry=http://progetrepo/feedname --scope=@inedo --always-auth
This way uses a username and password. If you want to use an API key, use API as the username as the API Key as the password.
Hope this helps!
Thanks,
Rich