I was trying to publish app to our internal Nexus repo (PRO 3.46.0-01) from our GitLab pipeline job. I created the publish token from the Nexus UI (base64 encoded user: base64 encoded password) But I got this error:
*npm notice Publishing to https:///repository/gitlab/ with tag latest and default access npm http fetch PUT 401 https:///repository/gitlab/reference-app 629ms npm verb stack HttpErrorAuthUnknown: Unable to authenticate, need: BASIC realm=“Sonatype Nexus Repository Manager” *
As part of my debugging, i changed the code from
"npm config set ${npm_publish_registry_host_and_path}:**_authToken**" "${NPM_PUBLISH_TOKEN}"
" npm config set "${npm_publish_registry_host_and_path}:**_auth**" "${NPM_PUBLISH_TOKEN}""
and it started working.
Please note that “NPM Bearer Token Realm” is enabled in our Nexus.
Is there anything wrong in the way Token generated ?(User Tokens)