Using User Token’s with NPM


The npm client login has a limitation of [a-z0-9] characters for the username whereas Nexus user tokens can include any characters that are available with Base64 encoding ( .



In order to use npm with user tokens edit your .npmrc file and use basic authentication, adding your base64 encoded user token.

An example .npmrc:

registry = http://localhost:8081/nexus/content/groups/npm-group/

In the above, the  _auth value is the base64 encoded representation of your User Token “<userCode>:<passCode>”.  There are two ways you can get this value:

Option 1:

Use one of the various encoding methods described here to encode your credentials.

Option 2:

In Nexus Repository Manager version 3.7 and higher the User Token Details view now displays the generated base64 encoded string that you can copy and paste into your .npmrc directly. As an example see the screenshot below.



Have more questions? Submit a request


Article is closed for comments.
Powered by Zendesk