docs: lead with npm's browser 2FA flow; support NPM_CONFIG_OTP - #12
Merged
Conversation
npm is moving away from authenticator codes toward WebAuthn (passkeys and security keys), so the browser approval flow is what most people will hit. Restructure the 2FA docs around it and demote --otp / --otp-secret to a collapsed legacy fallback. Also read NPM_CONFIG_OTP as a fallback for --otp. npm honors it on its own anyway, but reading it here keeps our "does this run need interactive 2FA?" checks in sync, so it no longer prints the browser-approval reminder or warms npm's auth cache when a code was already supplied via the env var.
|
The changes in this PR will be included in the next version bump.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


npm is moving away from authenticator codes toward WebAuthn (passkeys and security keys), so the browser approval flow is what most people will actually hit — not a code passed on the command line. The docs were written the other way around.
Docs
--otp/NPM_CONFIG_OTP/--otp-secretmoved into a collapsed legacy block, with a note that WebAuthn can't be automated headlessly at all — so if your account has moved off codes, those flags don't apply.Code
NPM_CONFIG_OTPis read as a fallback for--otpin both settings-construction paths (core.ts,interactive.ts).npm honors
NPM_CONFIG_OTPon its own since we shell out without overridingenv, so this isn't what makes it work — but reading it explicitly keeps fledgling's "does this run need interactive 2FA?" check in sync. Previously, setting the env var still printed the browser-approval reminder and ran the auth warm-up.No deprecation date or npm version is stated in the docs, since I don't have that confirmed — worth adding later if we do.