最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to create a Token in Nexus (for private packages) ? can't create a token through its UI - Stack Overflo

programmeradmin4浏览0评论

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 badges
Add a ment  | 

2 Answers 2

Reset to default 1

It 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:

  1. 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 
    
  2. Go to menu "Nexus -> Manage your user account -> NuGet API Key", press "Access API key".

  3. Type your password or username if using SSO login, press "Authenticate".

  4. Copy "Your NuGet API Key", press "Close" and "Sign out".

  5. 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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论