From 7c507c4d9e0b5b09a27fdaff1a2a5ef479777517 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Wed, 5 May 2021 13:18:07 +0200 Subject: [PATCH] fix(npm): pass `Basic` token as `_auth` key (#9861) --- lib/manager/npm/post-update/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/manager/npm/post-update/index.ts b/lib/manager/npm/post-update/index.ts index 083272c1612b0f..e72cef5c26b908 100644 --- a/lib/manager/npm/post-update/index.ts +++ b/lib/manager/npm/post-update/index.ts @@ -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)) {