Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-50920

NPM registry credentials not correctly formatted

    Details

    • Similar Issues:

      Description

      I am trying to use Jenkins to publish npm packages to a private npm repository.  I use the config-file-provider plugin to create a new npm config file.

      Creating the config looks like this:

      The credentials used in that config is a "username with password" credentials configured with the correct username/password for publishing to my repository.

       

      The publish part of my Jenkinsfile looks like:

      nodejs(nodeJSInstallationName: "6.12.0", configId: "npm-publish-config") {
          lerna publish --conventional-commits --yes
      }
      

       

      When I run the build I get the following error when it tries to publish: 

      need auth You need to authorize this machine using `npm adduser`

       

      I did a little debugging.  I was able to find the file it claims to have used as it's npm config:

      @myScope:registry = http://my.private.registry/
       //my.private.registry/:always-auth = true
       //my.private.registry/:username = jenkins
       //my.private.registry/:_password = <<redacted>>

      I have found no information online about the :username and :_password properties being supported by NPM.  Everything I have found has said that the .npmrc config file should have an _authToken property like this:

      @myScope:registry = http://my.private.registry/
       //my.private.registry/:always-auth = true
       //my.private.registry/:_authToken="SECRET"

      What am I doing wrong?

        Attachments

          Activity

          Hide
          nfalco Nikolas Falco added a comment -

          if you are using artifactory as company npm repository (as me), the email is required

          Show
          nfalco Nikolas Falco added a comment - if you are using artifactory as company npm repository (as me), the email is required
          Hide
          johnmcase John Case added a comment - - edited

          We are not using Artifactory.  We are using Verdaccio Publishing to it works manually with the authToken property as described in the issue.

          Show
          johnmcase John Case added a comment - - edited We are not using Artifactory.  We are using  Verdaccio Publishing to it works manually with the authToken property as described in the issue.
          Hide
          nfalco Nikolas Falco added a comment - - edited

          Today I have try to use

          //my.private.registry/:_authToken=<BASE64 user:password>

          to authenticate against our artifactory instance without success.

          I also found a stackoverflow post where nexus use the same configuration with username and _password instead of _authToken.

           

          More investigation is needed, I have no a plan to solve this.

          Show
          nfalco Nikolas Falco added a comment - - edited Today I have try to use //my.private.registry/:_authToken=<BASE64 user:password> to authenticate against our artifactory instance without success. I also found a stackoverflow post where nexus use the same configuration with username and _password instead of _authToken.   More investigation is needed, I have no a plan to solve this.
          Hide
          nfalco Nikolas Falco added a comment - - edited

          Looking for this issue again I see that you are trying to use authentication token method that is different with normal npm login.

          Indeed the authentication token (as seems from the this documentation) is created one time and always valid (unlike the password) and is the reason why in our environment

          //my.private.registry/:_authToken=<BASE64 user:password>

          does not works.

          Show
          nfalco Nikolas Falco added a comment - - edited Looking for this issue again I see that you are trying to use authentication token method that is different with normal npm login. Indeed the authentication token (as seems from the this documentation ) is created one time and always valid (unlike the password) and is the reason why in our environment //my.private.registry/:_authToken=<BASE64 user:password> does not works.

            People

            • Assignee:
              nfalco Nikolas Falco
              Reporter:
              johnmcase John Case
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: