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 NPM OTP token #1135

Open
BohdanPetryshyn opened this issue Mar 31, 2024 · 0 comments
Open

Support NPM OTP token #1135

BohdanPetryshyn opened this issue Mar 31, 2024 · 0 comments
Labels
feature-request A feature should be added or improved.

Comments

@BohdanPetryshyn
Copy link

Problem

NPM package can't be published with publib when 2FA is configured in the target NPM account.

Details

npm publish command used in publib-npm (source) requires an --opt flag when 2FA is configured. There's no equivalent env variable according to NPM docs.

Workaround

I was able to publish an NPM package by editing publib sources in node_modules. I added the --otp flag in node_modules/.bin/publib-npm:

  npm publish ${tag} ${access} ${file} --otp <my_temp_code> 2>&1 | tee ${log}

Suggested Solution

An NPM_OTP_TOKEN env variable could be supported by publib and used as the --otp flag value in the npm publish command. This won't be the optimal solution, though, as the OTP token is short-lived and will have to be updated right before running the publib command. A better solution would be to somehow allow npm publish to run in interactive mode and prompt the user for the OTP token. (see NPM OTP option docs).

@mrgrain mrgrain added the feature-request A feature should be added or improved. label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

2 participants