Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
This appears to be unrelated to #8869 despite the name of the issue reflecting the problem presented here.
I am attempting to publish my first package. My account does not have 2FA set up, I do not own a physical device with which to set up 2FA and the browser website only allows physical keys to be used to set up 2FA. I have followed the token creation steps as laid out in the documentation. When I run npm token list --json I can see two tokens, both of which should allow the bypassing of 2FA in publishing:
[
{
"name": REDACTED,
"description": REDACTED,
"key": REDACTED,
"token": REDACTED,
"expiry": "2026-04-29T14:11:13.703Z",
"cidr": [],
"bypass_2fa": true,
"revoked": null,
"created": "2026-04-22T14:11:13.713Z",
"updated": "2026-04-22T14:11:13.713Z",
"accessed": null,
"permissions": [
{
"name": "package",
"action": "write"
}
],
"scopes": [
{
"name": null,
"type": "package"
}
]
},
{
"name": REDACTED,
"description": REDACTED,
"key": REDACTED,
"token": REDACTED,
"expiry": "2026-07-21T13:34:42.483Z",
"cidr": [],
"bypass_2fa": true,
"revoked": null,
"created": "2026-04-22T13:34:42.536Z",
"updated": "2026-04-22T13:34:42.536Z",
"accessed": null,
"permissions": [
{
"name": "package",
"action": "write"
}
],
"scopes": [
{
"name": REDACTED,
"type": "package"
}
]
}
]
Instead, when I run npm publish --access public, I get the following logs:
npm error code E403
npm error 403 403 Forbidden - PUT https://registry.npmjs.org/@<my NPM username>%2ftest - Two-factor authentication or granular access token with bypass 2fa enabled is required to publish packages.
npm error 403 In most cases, you or one of your dependencies are requesting
npm error 403 a package version that is forbidden by your security policy, or
npm error 403 on a server you do not have access to.
with my NPM username redacted here.
I will note that whilst the website gave me the tokens when I created them, I have not needed to paste them verbatim anywhere.
Expected Behavior
I would expect this process to publish the package, per https://docs.npmjs.com/creating-and-publishing-scoped-public-packages.
Steps To Reproduce
- In a new directory,
npm init (npm init --scoped=@<your NPM username> can be used here but it does not appear to change anything).
- Specify the package name
@<your NPM username>/test and set the version to 0.0.0 and choose defaults for other properties.
- Create a simple
index.js file containing console.log("hello world");.
npm login and use the browser to log your account in.
- If you do not already have one, create an access token in your NPM account that is scoped to your username. This should have "bypass 2FA" ticked.
- For good measure, if you do not already have one, create another access token that has no scoping. This also should have "bypass 2FA" ticked.
- Check that
npm token list --json returns logs at least similar to what is presented in the "Current Behaviour" section of this report.
npm publish --access public
Environment
- npm: v11.12.1 (issue originally made for v10.9.3 but v11.12.1 has been tested as not working)
- Node.js: v22.18.0
- OS Name: Kubuntu Questing
- System Model Name: PC
- npm config: unchanged from defaults
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
This appears to be unrelated to #8869 despite the name of the issue reflecting the problem presented here.
I am attempting to publish my first package. My account does not have 2FA set up, I do not own a physical device with which to set up 2FA and the browser website only allows physical keys to be used to set up 2FA. I have followed the token creation steps as laid out in the documentation. When I run
npm token list --jsonI can see two tokens, both of which should allow the bypassing of 2FA in publishing:[ { "name": REDACTED, "description": REDACTED, "key": REDACTED, "token": REDACTED, "expiry": "2026-04-29T14:11:13.703Z", "cidr": [], "bypass_2fa": true, "revoked": null, "created": "2026-04-22T14:11:13.713Z", "updated": "2026-04-22T14:11:13.713Z", "accessed": null, "permissions": [ { "name": "package", "action": "write" } ], "scopes": [ { "name": null, "type": "package" } ] }, { "name": REDACTED, "description": REDACTED, "key": REDACTED, "token": REDACTED, "expiry": "2026-07-21T13:34:42.483Z", "cidr": [], "bypass_2fa": true, "revoked": null, "created": "2026-04-22T13:34:42.536Z", "updated": "2026-04-22T13:34:42.536Z", "accessed": null, "permissions": [ { "name": "package", "action": "write" } ], "scopes": [ { "name": REDACTED, "type": "package" } ] } ]Instead, when I run
npm publish --access public, I get the following logs:with my NPM username redacted here.
I will note that whilst the website gave me the tokens when I created them, I have not needed to paste them verbatim anywhere.
Expected Behavior
I would expect this process to publish the package, per https://docs.npmjs.com/creating-and-publishing-scoped-public-packages.
Steps To Reproduce
npm init(npm init --scoped=@<your NPM username>can be used here but it does not appear to change anything).@<your NPM username>/testand set the version to0.0.0and choose defaults for other properties.index.jsfile containingconsole.log("hello world");.npm loginand use the browser to log your account in.npm token list --jsonreturns logs at least similar to what is presented in the "Current Behaviour" section of this report.npm publish --access publicEnvironment