You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/getting-started/setting-up-your-npm-user-account/about-two-factor-authentication.mdx
+1-5Lines changed: 1 addition & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,10 +10,9 @@ redirect_from:
10
10
- Something you have (e.g., an ID badge or a cryptographic key).
11
11
- Something you are (e.g., a fingerprint or other biometric data).
12
12
13
-
When you enable 2FA, you will be prompted for a second form of authentication before performing certain actions on your account or packages to which you have write access. Depending on your 2FA configuration you will be either prompted to authenticate with a [security-key][webauthn] or a [time-based one-time password (TOTP)][totp].
13
+
When you enable 2FA, you will be prompted for a second form of authentication before performing certain actions on your account or packages to which you have write access. You will be prompted to authenticate with a [security-key][webauthn].
14
14
15
15
- The security-key flow allows you to use biometric devices such as Apple [Touch ID][touch-id], [Face ID][face-id] or [Windows Hello][windows-hello] as well as physical keys such as [Yubikey][yubikey], [Thetis][thetis] or [Feitian][feitian] as your 2FA.
16
-
- To configure TOTP you will need to install an authenticator application that can generate OTPs such as [Authy][authy], [Google Authenticator][google-authenticator], or [Microsoft Authenticator][microsoft-authenticator] on your mobile device.
17
16
18
17
<Note>
19
18
@@ -68,9 +67,6 @@ If you enable 2FA for authorization only. We will request a second form of authe
You can enable two-factor authentication (2FA) on your npm user account to protect against unauthorized access to your account and packages, either by using a [security-key][webauthn] or [time-based one-time password (TOTP)][totp] from a mobile app.
7
+
You can enable two-factor authentication (2FA) on your npm user account to protect against unauthorized access to your account and packagesusing a [security-key][webauthn].
8
8
9
9
## Prerequisites
10
10
11
11
Before you enable 2FA on your npm user account, you must:
12
12
13
13
- Update your npm client to version 5.5.1 or higher.
14
14
- To configure a security-key requires a modern browser that support [WebAuthn][can-i-use]. This will allow you to configure a biometric devices featuring Apple [Touch ID][touch-id], [Face ID][face-id], or [Windows Hello][windows-hello] as well as physical keys such as [Yubikey][yubikey], [Thetis][thetis], or [Feitian][feitian].
15
-
- To configure TOTP you will need to install an authenticator application that can generate OTPs such as [Authy][authy], [Google Authenticator][google-authenticator], or [Microsoft Authenticator][microsoft-authenticator] on your mobile device.
16
15
17
16
For more information on supported 2FA methods, see "[About two-factor authentication][about-two-factor-authentication]".
18
17
19
-
<Note>
20
-
21
-
**Note:** npm does not accept SMS (text-to-phone) as a 2FA method.
22
-
23
-
</Note>
24
-
25
18
## Configuring 2FA from the website
26
19
27
20
### Enabling 2FA
@@ -44,19 +37,15 @@ For more information on supported 2FA methods, see "[About two-factor authentica
- When using an **authenticator application** on your phone, open it and scan the QR code on the two-step verification page. Enter the code generated by the app, then click **Verify**.
7. On the recovery code page, copy the recovery codes to your computer or other safe location that is not your second factor device. We recommend using a password manager.
61
50
62
51
<Screenshotsrc="/getting-started/setting-up-your-npm-user-account/recovery-code.png"alt="Screenshot showing the Recovery Code page" />
@@ -123,16 +112,20 @@ If you have 2FA enabled, you can remove it from your account settings page.
123
112
124
113
## Configuring 2FA from the command line
125
114
126
-
### Enabling 2FA from the command line
115
+
### Enabling 2FA settings from the command line
127
116
128
-
Although security-key with WebAuthn can be used for authentication from both the web and the command line, it can only be configured from the web. When enabling 2FA from the command line, currently the only available option is to use an TOTP mobile app.
117
+
Security-key with WebAuthn can be used for authentication from both the web and the command line, but it can only be configured from the web. We recommend configuring 2FA using security-keys through the web interface.
129
118
130
119
<Note>
131
120
132
121
**Note:** Settings you configure on the command line will also apply to your profile settings on the npm website.
133
122
134
123
</Note>
135
124
125
+
For the best security experience, we recommend configuring 2FA through the web interface where you can set up security-key authentication.
126
+
127
+
If you need to enable 2FA from the command line:
128
+
136
129
1. If you are logged out on the command line, log in using `npm login` command.
137
130
138
131
2. On the command line, type the [`npm profile`](/cli/profile) command along with the option for the 2FA mode you want to enable:
@@ -148,24 +141,9 @@ Although security-key with WebAuthn can be used for authentication from both the
148
141
npm profile enable-2fa auth-only
149
142
```
150
143
151
-
3. To add npm to your authenticator application, using the device with the app, you can either:
152
-
- Scan the QR code displayed on the command line.
153
-
- Type the number displayed below the QR code.
154
-
155
-
4. When prompted to add an OTP code from your authenticator, on the command line, enter a one-time password generated by your authenticator app.
156
-
157
-
### Sending a one-time password from the command line
158
-
159
-
If you have enabled 2FA auth-and-writes, you will need to send the TOTP from the command line for certain commands to work. To do this, append `--otp=123456` (where _123456_ is the code generated by your authenticator) at the end of the command. Here are a few examples:
If you have enabled 2FA auth-and-writes, authentication will be handled automatically when using security-keys. For commands that require 2FA, you will be prompted to authenticate with your configured 2FA method.
4. When prompted for a one-time password, enter a password from your authenticator app:
185
-
186
-
<Prompt>Enter one-time password from your authenticator: <strong>123456</strong></Prompt>
162
+
4. You will be prompted to authenticate with your configured 2FA method to complete the removal.
187
163
188
164
## Configuring account recovery options
189
165
@@ -210,22 +186,12 @@ When you enable 2FA on your npm user account, we strongly recommend you link you
210
186
211
187
The Twitter or GitHub account is now linked to your npm account. To remove the link to either account, you can click the **Remove** button next to the account you want to remove from your npm account.
212
188
213
-
## Resolving TOTP errors
214
-
215
-
If you are entering what seems to be a valid [TOTP][totp] but you see an error, be sure that you are using the correct authenticator account. If you have multiple authenticator accounts, using an TOTP from the wrong account will cause an error.
216
-
217
-
Also, when you reset two-factor authentication after it has been disabled, the authenticator might create a second account with the same name. Please see the authenticator documentation to delete the old account.
Copy file name to clipboardExpand all lines: content/getting-started/setting-up-your-npm-user-account/recovering-your-2fa-enabled-account.mdx
-35Lines changed: 0 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,8 +22,6 @@ If you have misplaced the device that provided second-factor authentication, you
22
22
23
23
<>{shared['use-recovery-code'].image}</>
24
24
25
-
_Note: If you have configured to use TOTP, you will see an TOTP prompt instead_
26
-
27
25
4. Enter an unused recovery code in the "Use a Recovery Code" prompt.
28
26
29
27
<Screenshotsrc="/getting-started/setting-up-your-npm-user-account/user-a-recovery-code.png"alt="Screenshot showing use a recovery code prompt with an input box to enter the recovery code" />
@@ -32,38 +30,6 @@ If you have misplaced the device that provided second-factor authentication, you
32
30
33
31
6. (Optional) To disable 2FA, see "[Disabling 2FA][removing-2fa-on-the-web]".
34
32
35
-
### Using recovery code from the command line
36
-
37
-
1. Locate the recovery codes generated when you enabled 2FA on your account.
38
-
39
-
2. If you are logged out on the command line, log in using `npm login` command with your username and npm password.
40
-
41
-
3. Enter an unused recovery code when you see this prompt:
42
-
43
-
<Prompt>Enter one-time password:</Prompt>
44
-
45
-
4. Once you are logged in, use the below and enter your npm password if prompted.
46
-
47
-
```
48
-
npm profile disable-2fa
49
-
```
50
-
51
-
5. Enter another unused recovery code when you see this prompt:
52
-
53
-
<Prompt>Enter one-time password:</Prompt>
54
-
55
-
6. npm will confirm that two-factor authentication has been disabled.
56
-
57
-
7. Follow the steps outlined in "[Configuring two-factor authentication][configuring-two-factor-authentication]" to re-enable 2FA and generate new recovery codes.
58
-
59
-
<Note>
60
-
61
-
**Note:** Using the recovery codes to re-enable 2FA may create a new authenticator account with the same npm account name.
62
-
63
-
If you are using a [time-based one-time password (TOTP)][totp] mobile app and want to delete the old authenticator account, follow the steps for the authenticator.
64
-
65
-
</Note>
66
-
67
33
## Viewing and regenerating recovery code
68
34
69
35
<Note>
@@ -126,4 +92,3 @@ If you have misplaced both your 2FA device and your recovery codes, you can cont
0 commit comments