Skip to content

Re-verify npm auth after auto-login - #800

Merged
sindresorhus merged 1 commit into
mainfrom
fix-npm-login-loop
Jul 14, 2026
Merged

sindresorhus merged 1 commit into
mainfrom
fix-npm-login-loop

Conversation

@sindresorhus

Copy link
Copy Markdown
Owner

After auto-running npm login, re-check npm whoami and fail with a clear, actionable error if still not authenticated, instead of silently continuing to a second whoami check that re-throws a generic message. The common cause is a project-level .npmrc holding a stale or revoked token that overrides the session token npm login writes to the user .npmrc.

Fixes #795

After auto-running `npm login`, re-check `npm whoami` and fail with a clear, actionable error if still not authenticated, instead of silently continuing to a second whoami check that re-throws a generic message. The common cause is a project-level `.npmrc` holding a stale or revoked token that overrides the session token `npm login` writes to the user `.npmrc`.

Fixes #795
@sindresorhus
sindresorhus merged commit 55ed2bf into main Jul 14, 2026
6 checks passed
@sindresorhus
sindresorhus deleted the fix-npm-login-loop branch July 14, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Npm login fails in loop

1 participant