使用双重身份验证访问 npm
使用安全密钥流从命令行登录
在命令行上,键入
npm login
命令。出现提示时,提供您的用户名、密码和电子邮件地址。
user@host:~$ npm login npm notice Log in on https://registry.npmjs.org/ Username: mona Password: Email: (this IS public) mona@github.com npm notice Open https://www.npmjs.com/login/913c3ab1-89a0-44bd-be8d-d946e2e906f0 to use your security key for authentication or enter OTP from your authenticator app
如果您已配置安全密钥,请打开命令行中显示的提供的 URL。或者,如果您已配置移动验证器,请跳至步骤 6。
单击使用安全密钥并按照浏览器特定的步骤进行身份验证。
复制生成的令牌
EoORjqMvgtDszw6xXHVCRe9Oha4mn700rr4j0tnbEVLrPNttVTwQItrG3UhDz68p
HH1HSfRnU0vNDuL/upfftIQh2ytNmnbBJyfaiCpe0SI=
使用 --auth-type=web 从命令行登录
/yw6NN9GrrUvwPnEKrJxfzjt4BAyzpgLbpS7QM0gD5Xf9ttJsok69Ppi2RPWwwyiwZvQQtuNqw6D1jj/Df+tgFu8vwTc0Gx16XfdHfE7t+iJiDaJJS4NXXgDztYnVgFOtK03VACfNU+BbMmtveOKtoaWqwsiUhniXd/msSIpuV0=
使用现有的浏览器会话
75lTrFl14dFpONcFuVWK33fzWQvihiEejGq7QHgV2ePZ7jpXzOlItJWCuUUl57awo3RkiT3LPGj4m5g2kjyi6NixSMqwgCC8dhqNAGP77/AvqyTJsWhMRiFwxqGjHY5cpt85+GOLGYbr0vqMMxYiA8ZNa4uxH8MDaPa8DW1taiA=
caGQE52Bc4IQJ2JKvfbFHaOSayQyDNPXLQC9GC7+QjLtnF/ZzuO6rqou5TJdrEvshL2KpWNLMeM40F7gSxswCdi6ecFX74TJbOIjPEJKvJmz2GskDpYdt9OCcnVGkbp0ZuYK01Qm1dSah3YpNgaYDA==
user@host:~$ npm login
npm notice Log in on https://registry.npmjs.org/
Authenticate your account at:
https://www.npmjs.com/login?next=/login/cli/b1a2f96a-ce09-4463-954c-c99f6773b922
Press ENTER to open in the browser...
O4Ocq5EEzFSo/I308KY+PNCmcHK7EhPqIxhrPUvER6/xQE4JNgpE1m8HiJnROnQEe/52oaqSnQuzv3bUyJmxJdqKWxj2QU/T2Sqjhu9muuI=
BotpvuJgiYw1Jyl7ofx8pqbaFLPWAtsjMlSAmDgsrG1ofyx19uf+WodWq6FeRLaQ07IAgCETCn+jK3ggdPPVPZlbkPOz5770mVkUCVDI5E0=
没有现有的浏览器会话
75lTrFl14dFpONcFuVWK33fzWQvihiEejGq7QHgV2ePZ7jpXzOlItJWCuUUl57awo3RkiT3LPGj4m5g2kjyi6NixSMqwgCC8dhqNAGP77/AvqyTJsWhMRiFwxqGjHY5cpt85+GOLGYbr0vqMMxYiA8ZNa4uxH8MDaPa8DW1taiA=
caGQE52Bc4IQJ2JKvfbFHaOSayQyDNPXLQC9GC7+QjLtnF/ZzuO6rqou5TJdrEvshL2KpWNLMeM40F7gSxswCdi6ecFX74TJbOIjPEJKvJmz2GskDpYdt9OCcnVGkbp0ZuYK01Qm1dSah3YpNgaYDA==
user@host:~$ npm login
npm notice Log in on https://registry.npmjs.org/
Authenticate your account at:
https://www.npmjs.com/login?next=/login/cli/b1a2f96a-ce09-4463-954c-c99f6773b922
Press ENTER to open in the browser...
FHYv0ay2rs/LQcQZF2rfOzG3h/EiLg2SM2s7VqNPKic4YhJ5Z7fz/64pg+jKGNUo/wOc5q2gLIiDdp57sp0Z6FvSvzgf8dgkexTZvVYCk+hwlIWAIvx99FTCoISJUa77WQxuqTZLN+Ot3QwVEua2e7O2N2qXBz/uRWM14nQqDUg=
O4Ocq5EEzFSo/I308KY+PNCmcHK7EhPqIxhrPUvER6/xQE4JNgpE1m8HiJnROnQEe/52oaqSnQuzv3bUyJmxJdqKWxj2QU/T2Sqjhu9muuI=
BotpvuJgiYw1Jyl7ofx8pqbaFLPWAtsjMlSAmDgsrG1ofyx19uf+WodWq6FeRLaQ07IAgCETCn+jK3ggdPPVPZlbkPOz5770mVkUCVDI5E0=