Ability to add custom headers for registry calls?

(Mathew Goldsborough) #1

Hi all. I’m working on a project which requires the inclusion of an API key in headers of the npm publish command, specifically x-api-key.

Is there a way to provide custom headers to the npm publish (or adduser) commands?


(Rebecca Turner) #2

There is no way. I would recommend that you use the existing authentication mechanisms.

If you have this in your .npmrc:


Then when talking to my-registry.host.name we’ll send the following header:

Authorization: Bearer VALUE

(system) #3

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.