Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support OTP for npm 2factor authentication #27

Closed
mbehzad opened this issue Jan 19, 2022 · 1 comment · Fixed by #28
Closed

Support OTP for npm 2factor authentication #27

mbehzad opened this issue Jan 19, 2022 · 1 comment · Fixed by #28

Comments

@mbehzad
Copy link
Contributor

mbehzad commented Jan 19, 2022

If someone has enabled two factor authentication for their npm account, running npmpub command will fail with the following error.

npm ERR! code EOTP
npm ERR! This operation requires a one-time password from your authenticator.
npm ERR! You can provide a one-time password by passing --otp=<code> to the command you ran.
npm ERR! If you already provided a one-time password then it is likely that you either typoed
npm ERR! it, or it timed out. Please try again.

a workaround for this issue is to set the one time password via the environment variable (NPM_CONFIG_OTP=123456) when calling the npmpub cli. But in a lot of repos npm install & npm test alone will take more than the life time of the one time password.

It would be helpful if right before the npm publish, user would be prompted to enter their otp in the cli.

If you are interested, i can provided a PR.

@MoOx
Copy link
Owner

MoOx commented Jan 20, 2022

Would be nice. PR welcome!

mbehzad added a commit to mbehzad/npmpub that referenced this issue Jan 22, 2022
Add support for access=public flag for npm publish
Update eslint es parse version to support async/await syntax
@MoOx MoOx closed this as completed in #28 Mar 7, 2022
MoOx pushed a commit that referenced this issue Mar 7, 2022
Add support for access=public flag for npm publish
Update eslint es parse version to support async/await syntax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants