How to generate NPM bearer token under sonatype nexus.

5,354 views
Skip to first unread message

Bindu Korrakooti

unread,
May 12, 2020, 1:10:44 AM5/12/20
to Nexus Users

I tried to create a read only token using my credentials as described in https://docs.npmjs.com/creating-and-viewing-authentication-tokens using 

npm create token --read-only

 

however I get the below error:


C:\Users>npm token create

npm password:

npm ERR! code E401

npm ERR! Unable to authenticate, your authentication token seems to be invalid.

npm ERR! To correct this please trying logging in again with:

npm ERR!     npm login


npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\AppData\Roaming\npm-cache\_logs\2020-05-08T08_31_38_739Z-debug.log


Could you please suggest the feasible steps to generate NPM token.

Bindu Korrakooti

unread,
May 12, 2020, 1:22:24 AM5/12/20
to Nexus Users

Dawid Sawa

unread,
May 12, 2020, 5:45:20 AM5/12/20
to Nexus Users


On Tuesday, May 12, 2020 at 6:10:44 AM UTC+1, Bindu Korrakooti wrote:


npm ERR! code E401

npm ERR! Unable to authenticate, your authentication token seems to be invalid.

npm ERR! To correct this please trying logging in again with:

npm ERR!     npm login


The above error you got says you are not authenticated in NXRM. Either you have not ran npm login beforehand or your NXRM allows token authentication only which means you have to access your user token via NXRM UI.

Bindu Korrakooti

unread,
May 13, 2020, 1:13:54 AM5/13/20
to Nexus Users

Am able to login , please find the attached snippet for the reference.
login.PNG

Peter Lynch

unread,
May 13, 2020, 3:47:51 PM5/13/20
to Bindu Korrakooti, Nexus Users
The problem is you are using the "npm token create" command. This command is not supported by NXRM.

Only npm login / npm adduser is supported.



--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/98031102-0684-4127-98d6-6dd8ce83df21%40glists.sonatype.com.


--
Sonatype
Peter Lynch
Senior Product Support Engineer

Reply all
Reply to author
Forward
0 new messages