We're using Sonatype Nexus Repository ManagerOSS 3.29.0-02 and we're trying to create a TOKEN
to work with .npmrc
in the following structure :
registry=http://NEXUS-IP:8081/repository/GROUP-NAME
http://NEXUS-IP:8081/repository/GROUP-NAME/:_authToken=NpmToken.XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
When I'm logged into the Sonatype Nexus Repository ManagerOSS I can't find anything that creates a valid token.
However , when I hit npm login
from the mand line and type the Username and Password ,
the npm install
works.
How can we create a valid TOKEN for those Username/Password pair for the Nexus Artifactory , so I'll be able to use that token from a Docker ?
We're using Sonatype Nexus Repository ManagerOSS 3.29.0-02 and we're trying to create a TOKEN
to work with .npmrc
in the following structure :
registry=http://NEXUS-IP:8081/repository/GROUP-NAME
http://NEXUS-IP:8081/repository/GROUP-NAME/:_authToken=NpmToken.XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
When I'm logged into the Sonatype Nexus Repository ManagerOSS I can't find anything that creates a valid token.
However , when I hit npm login
from the mand line and type the Username and Password ,
the npm install
works.
How can we create a valid TOKEN for those Username/Password pair for the Nexus Artifactory , so I'll be able to use that token from a Docker ?
Share Improve this question asked Dec 23, 2020 at 12:26 JANJAN 21.9k66 gold badges189 silver badges336 bronze badges2 Answers
Reset to default 1It appears that authenticating w/ AuthTokens (i.e. User Token Realm ) is only available in Nexus Pro :
https://help.sonatype./repomanager3/nexus-repository-administration/user-authentication/security-setup-with-user-tokens
User tokens is available only in PRO version of Nexus (see parison), but you can use "Single sign-on patch for Nexus OSS" which provides an alternative implementation of tokens without violating the license. The creation of tokens is implemented through the "NuGet API Key" menu, however, the tokens themselves apply to all types of repositories. Example of usage user token:
Run Nexus container from image "ghcr.io/a-langer/nexus-sso:3.46.0":
git clone https://github./a-langer/nexus-sso.git cd ./nexus-sso docker pose up -d
Go to menu "Nexus -> Manage your user account -> NuGet API Key", press "Access API key".
Type your password or username if using SSO login, press "Authenticate".
Copy "Your NuGet API Key", press "Close" and "Sign out".
The received token can be used instead of a password in settings NPM, Docker, Maven and etc.
Each user can set a personal token that can be used instead of a password.