#3273·lerna

Support npmjs.com security keys for 2FA

Author: Frederick888Created Aug 1, 2022Updated Aug 31, 2026
Labelstype: feature

Description

When publishing a package to npmjs.com, if the account uses security keys for 2FA, offer a https://www.npmjs.com/login/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx link where user can use security key to obtain an OTP.

Motivation

At the moment the only reason for me to have a software authenticator in my npmjs.com account is to publish packages with lerna. It'd be great if I can keep only the hardware tokens which are more secure.

Suggested Implementation

I'm not sure how lerna interacts with npmjs.com, but it'd be nice if we can have something similar to npm publish/yarn publish.

npm publish:

bash
npm notice Publishing to https://registry.npmjs.org/
npm notice Open https://www.npmjs.com/login/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx to use your security key for authentication or enter OTP from your authenticator app
This operation requires a one-time password.
Enter OTP:

yarn publish:

info Two factor authentication enabled.
info Open https://www.npmjs.com/login/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx to use your security key for authentication or enter OTP from your authenticator app
question npm one-time password:

Screenshot_20220801_223821 Screenshot_20220801_223856

Alternate Implementations