Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Solved Cloudron CLI & 2FA

    Support
    cli nodejs
    3
    8
    285
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ghodgeon
      ghodgeon last edited by girish

      Hi, if I try to login locally to cloudron via the CLI with 2FA enabled, I only get the option to login with user/pass. Then it fails.

      The docs at cloudron login -h don't show how to proceed

      Failed to login: Cannot destructure property 'rejectUnauthorized' of 'options' as it is undefined.
      
      girish 1 Reply Last reply Reply Quote 0
      • girish
        girish Staff @ghodgeon last edited by girish

        @ghodgeon this is most likely a node version issue. You need atleast node 14 for the CLI. You can check your current version using node --version.

        ghodgeon 1 Reply Last reply Reply Quote 0
        • ghodgeon
          ghodgeon @girish last edited by

          @girish

          I do believe I'm on v16.9.1 -- I installed Node based on the instructions as I followed.

          1 Reply Last reply Reply Quote 0
          • fbartels
            fbartels App Dev last edited by

            We have run into the same issue this morning. But running node 16.13.0-deb-1nodesource1 (which is current version from their repo).

            After a downgrade of the cloudron cli to 4.11.0 the login succeeded.

            girish 1 Reply Last reply Reply Quote 0
            • girish
              girish Staff @fbartels last edited by

              @fbartels What version of CLI did you downgrade from?

              The error message is coming from https://git.cloudron.io/cloudron/cloudron-cli/-/blob/master/src/actions.js#L310 . I think the actual exception is caused by the de-structuring in
              https://git.cloudron.io/cloudron/cloudron-cli/-/blob/master/src/actions.js#L255 . Strange, I don't see how options can ever be undefined.

                      const [error, result] = await safe(authenticate(adminFqdn, username, password, { rejectUnauthorized, askForTotpToken: false }));
                      if (error) return exit(`Failed to login: ${error.message}`);
              
              1 Reply Last reply Reply Quote 0
              • girish
                girish Staff last edited by girish

                Oh found it, https://git.cloudron.io/cloudron/cloudron-cli/-/blob/master/src/actions.js#L267 is obviously wrong since it's missing an argument.

                1 Reply Last reply Reply Quote 0
                • girish
                  girish Staff last edited by girish

                  @fbartels @ghodgeon I guess you have 2FA enabled? I can reproduce it with 2FA. (er, doh, i didn't see the title of this post).

                  $ cloudron login my.cloudron.domain
                  Existing token possibly expired: Invalid token. Use cloudron login again.
                  Username: girish
                  Password: *********
                  Failed to login: Cannot destructure property 'rejectUnauthorized' of 'options' as it is undefined.
                  
                  1 Reply Last reply Reply Quote 0
                  • girish
                    girish Staff last edited by

                    I have pushed a new CLI version v4.12.7 that fixes this.

                    1 Reply Last reply Reply Quote 3
                    • First post
                      Last post
                    Powered by NodeBB