Authentication for NPM publish registry along with registry for dependencies

I am not a JS developer, but I have to create pipeline thats build and publish NodeJS package. We have JFROG repository for our npm packages. So first in our pipeline we create .npmrc file for authentication during dependency download.

registry=https://my-registry.com/artifactory/api/npm/dependencies
always-auth=true
//my-registry.com/artifactory/api/npm/dependencies/:_auth=**base64token**

then we are using

npm ci
npm run build

and at this point everything works fine. In packages.json we have also:

"publishConfig": {
  "registry": "https://my-registry.com/artifactory/api/npm/published-packages"
}

and now we want to publish our package to this registry from above. But when we do npm publish it shows us authentication error and tells us that we need to use npm adduser to be able to publish. The problem is that we are running this in pipeline so it can’t be interactive.

I tried to change .npmrc (via changing registry and _auth) before running npm publish but the error is still the same.

So there are two questions:

  1. Is there any possibility to log in to certain registry for publishing pourpose without prompt?
  2. Can we have somehow defined multiple authentication for different registries in one .npmrc?