Skip to content

Commit

Permalink
fix(npm): pass Basic token as _auth key (#9861)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed May 5, 2021
1 parent 31ba0a5 commit 7c507c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/manager/npm/post-update/index.ts
Expand Up @@ -447,15 +447,16 @@ export async function getAdditionalFiles(
});
for (const hostRule of npmHostRules) {
if (hostRule.token) {
const key = hostRule.authType === 'Basic' ? '_auth' : '_authToken';
if (hostRule.baseUrl) {
additionalNpmrcContent.push(
`${hostRule.baseUrl}:_authToken=${hostRule.token}`
`${hostRule.baseUrl}:${key}=${hostRule.token}`
.replace('https://', '//')
.replace('http://', '//')
);
} else if (hostRule.hostName) {
additionalNpmrcContent.push(
`//${hostRule.hostName}/:_authToken=${hostRule.token}`
`//${hostRule.hostName}/:${key}=${hostRule.token}`
);
}
} else if (is.string(hostRule.username) && is.string(hostRule.password)) {
Expand Down

0 comments on commit 7c507c4

Please sign in to comment.