From 992799cd8c4427ed8c57270b399b2d6bbc94f2a8 Mon Sep 17 00:00:00 2001 From: Gar Date: Mon, 7 Jun 2021 15:56:04 -0700 Subject: [PATCH] fix(login): properly save scope if defined setCredentialsByURI was clobbering the saving of the scope:registry config PR-URL: https://github.com/npm/cli/pull/3383 Credit: @wraithgar Close: #3383 Reviewed-by: @nlf --- lib/adduser.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/adduser.js b/lib/adduser.js index fb1e323512b6d..e502276a1743c 100644 --- a/lib/adduser.js +++ b/lib/adduser.js @@ -75,11 +75,9 @@ class AddUser extends BaseCommand { async updateConfig ({ newCreds, registry, scope }) { this.npm.config.delete('_token', 'user') // prevent legacy pollution - + this.npm.config.setCredentialsByURI(registry, newCreds) if (scope) this.npm.config.set(scope + ':registry', registry, 'user') - - this.npm.config.setCredentialsByURI(registry, newCreds) await this.npm.config.save('user') } }