shannah / jdeploy

Developer friendly desktop deployment tool
https://www.jdeploy.com
Apache License 2.0
358 stars 19 forks source link

Cannot deploy as One Time Password is not provided. #74

Open ravn opened 2 years ago

ravn commented 2 years ago

I am new to jdeploy (my idea is to make Apache Maven more accessible by providing a jdeploy installer) and ran into this showstopper when trying to deploy my tiny proof-of-concept app.

npm notice Publishing to https://registry.npmjs.org/
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.

Being new to this I do not know when OTP were introduced but it is clearly after the jdeploy documentation was written.

Would the simplest fix be to add a textbox to provide the OTP in and then pass it down using the --otp=... flag if provided?

shannah commented 2 years ago

It does try to deal with the one-time password but it is flakey. It has been reported that updating NodeJS to the latest fixes this issue. An alternative workaround for now, is to first login using the CLI. (i.e. npm login), then do your publish.

ravn commented 2 years ago

I had installed the LTS version of node.js, which had 8.11 of npm. Upgrading manually to 8.13.2 with packages, (which in the process upgraded jdeploy to 3.2.0) and logging in again did not change the error message.

This is under MacOS 12.4 x64.

Suggestions?

shannah commented 2 years ago

So you're logged in in the CLI with npm and it still doesn't work? See https://github.com/shannah/jdeploy/issues/33

ravn commented 2 years ago

Yes. I have enabled 2FA for NPM with a suitable authenticator, which might be a mistake given this.

What is the correct place to add the --otp=xxxx snippet in the JDeploy GUI? (Better to ask than guess these things)

shannah commented 2 years ago

The jDeploy GUI will try to identify when the CLI prompts for it, and it will give you a dialog box to enter the OTP. But this is currently version-dependent as it uses heuristics to identify this.

If this isn't working, then you should

  1. Login using the npm command line. (If you can type npm whoami and it gives your username, then you're logged in).
  2. Publish using either the jDeploy GUI or the jDeploy CLI. From the cli, it is just jdeploy publish.
EtienneLamoureux commented 1 year ago

Had the same problem, fixed using by doing:

  1. Login into npmjs.com
  2. Go to the account setting, the "Manage Two-Factor Authentication"
  3. In the "Additional Options" section, uncheck "Require two-factor authentication for write actions"
  4. Click the "Update Preferences" button
  5. Run jdeploy publish