@@ -142,7 +142,7 @@ <h1 id="npmrc">npmrc</h1>
142
142
143
143
< section id ="table_of_contents ">
144
144
< h2 id ="table-of-contents "> Table of contents</ h2 >
145
- < div id ="_table_of_contents "> < ul > < li > < a href ="#description "> Description</ a > </ li > < li > < a href ="#files "> Files</ a > </ li > < ul > < li > < a href ="#comments "> Comments</ a > </ li > < li > < a href ="#per-project-config-file "> Per-project config file</ a > </ li > < li > < a href ="#per-user-config-file "> Per-user config file</ a > </ li > < li > < a href ="#global-config-file "> Global config file</ a > </ li > < li > < a href ="#built-in-config-file "> Built-in config file</ a > </ li > </ ul > < li > < a href ="#see-also "> See also</ a > </ li > </ ul > </ div >
145
+ < div id ="_table_of_contents "> < ul > < li > < a href ="#description "> Description</ a > </ li > < li > < a href ="#files "> Files</ a > </ li > < ul > < li > < a href ="#comments "> Comments</ a > </ li > < li > < a href ="#per-project-config-file "> Per-project config file</ a > </ li > < li > < a href ="#per-user-config-file "> Per-user config file</ a > </ li > < li > < a href ="#global-config-file "> Global config file</ a > </ li > < li > < a href ="#built-in-config-file "> Built-in config file</ a > </ li > </ ul > < li > < a href ="#auth-related-configuration " > Auth related configuration </ a > </ li > < li > < a href =" # see-also "> See also</ a > </ li > </ ul > </ div >
146
146
</ section >
147
147
148
148
< div id ="_content "> < h3 id ="description "> Description</ h3 >
@@ -204,6 +204,29 @@ <h4 id="built-in-config-file">Built-in config file</h4>
204
204
consistent across updates. Set fields in here using the < code > ./configure</ code >
205
205
script that comes with npm. This is primarily for distribution maintainers
206
206
to override default configs in a standard and consistent manner.</ p >
207
+ < h3 id ="auth-related-configuration "> Auth related configuration</ h3 >
208
+ < p > The settings < code > _auth</ code > , < code > _authToken</ code > , < code > username</ code > and < code > _password</ code > must all be
209
+ scoped to a specific registry. This ensures that < code > npm</ code > will never send
210
+ credentials to the wrong host.</ p >
211
+ < p > In order to scope these values, they must be prefixed by a URI fragment.
212
+ If the credential is meant for any request to a registry on a single host,
213
+ the scope may look like < code > //registry.npmjs.org/:</ code > . If it must be scoped to a
214
+ specific path on the host that path may also be provided, such as
215
+ < code > //my-custom-registry.org/unique/path:</ code > .</ p >
216
+ < pre > < code > ; bad config
217
+ _authToken=MYTOKEN
218
+
219
+ ; good config
220
+ @myorg:registry=https://somewhere-else.com/myorg
221
+ @another:registry=https://somewhere-else.com/another
222
+ //registry.npmjs.org/:_authToken=MYTOKEN
223
+ ; would apply to both @myorg and @another
224
+ ; //somewhere-else.com/:_authToken=MYTOKEN
225
+ ; would apply only to @myorg
226
+ //somewhere-else.com/myorg/:_authToken=MYTOKEN1
227
+ ; would apply only to @another
228
+ //somewhere-else.com/another/:_authToken=MYTOKEN2
229
+ </ code > </ pre >
207
230
< h3 id ="see-also "> See also</ h3 >
208
231
< ul >
209
232
< li > < a href ="../configuring-npm/folders.html "> npm folders</ a > </ li >
0 commit comments