tursodatabase / turso-cli

Command line interface to Turso.

Home Page:https://turso.tech

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Headless login experience still sucks

penberg opened this issue · comments

Here's my journey of using the turso CLI over ssh.

First try:

[penberg@turing ~]$ turso auth login
/usr/bin/xdg-open: line 881: www-browser: command not found
/usr/bin/xdg-open: line 881: links2: command not found
/usr/bin/xdg-open: line 881: elinks: command not found
/usr/bin/xdg-open: line 881: links: command not found
/usr/bin/xdg-open: line 881: lynx: command not found
/usr/bin/xdg-open: line 881: w3m: command not found
xdg-open: no method available for opening 'https://api.turso.tech?port=34893&redirect=true&type=cli'
error: Unable to open browser.
Visit this URL on this device to log in:
https://api.turso.tech?port=34893&redirect=true&type=cli
Waiting for authentication...
^C

Oops, luckily I remember that there a --headless command line option I use. Of course, the CLI should figure that out automatically because of the error to open a browser (and hide the debugging traces).

Unfortunately, the forced auto-update ruined first try for me:

[penberg@turing ~]$ turso auth login --headless
Visit this URL on this device to log in:
https://api.turso.tech?redirect=false

Friendly reminder that there's a newer version of Turso CLI available.
You're currently using version v0.86.3 while latest available version is v0.87.6.
Please consider updating to get new features and more stable experience. To update:


	turso update
Updating to the latest version

Welcome to the Turso installer!

                 .:                                 .:
  .$$.   $$:   .$$$:                                $$$^    $$:   ~$^
  .$$$!:$$$  .$$$$~                                 .$$$$^  !$$~^$$$~
    $$$$$$ .$$$$$~                                   .$$$$$^ $$$$$$:
     !$$$$$$$$$$~                                     .$$$$$$$$$$$
      :$$$$$$$$~                                       .$$$$$$$$!
     .$$$$$$$$~                                         .$$$$$$$$^
    .$$$$$$$$!       ~$!                       :$$.      :$$$$$$$$^
     $$$$$$$$$$$!^::$$$$$^...................:$$$$$!.^~$$$$$$$$$$$:
     $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
     :$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$!
        :^!$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$~:.
           :$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$!
      $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$:
      :$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$~
        ^$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$~.
           :$$$$$:   .^~!$$$$$$$$$$$$$$$$$$$$$$!^:.   $$$$$!
           :$$$$$!.         .!$$$$$$$$$$$$.         .^$$$$$!
           :$$$$$$$$$$!^:.   ~$$$$$$$$$$$$    .^~$$$$$$$$$$!
           :$$$$$$$$$$$$$$$. ~$$$$$$$$$$$$  $$$$$$$$$$$$$$$!
           :$$$$$$$$$$$$$$$: ~$$$$$$$$$$$$  $$$$$$$$$$$$$$$!
           :$$$$$$$$$$$$$$$^ ~$$$$$$$$$$$$  $$$$$$$$$$$$$$$!
           :$$$$$$$$$$$$$$$~ ~$$$$$$$$$$$$  $$$$$$$$$$$$$$$!
           :$$$$$$$$$$$$$$$$~^^:.     ..:^~!$$$$$$$$$$$$$$$!
           ^$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$!
           :$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$~
            :$$$$$$$$$$$$$:$$$$$$$$$$$$$$$$$~~$$$$$$$$$$$$~
              !$$$$$$$$$$. :$$..$$! :$$^ !$!  ~$$$$$$$$$$.
               ^$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$!
                 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$:
                  ~$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
                   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
                     $$$$$~$$$$$^$$$$$~$$$$$$~$$$$:
                      $$^  .$$$   $$$:  ~$$^  .$$^
                      ..     :     :     :.     :

Downloading Linux_x86_64 ...
######################################################################## 100.0%

Installing to /home/penberg/.turso

Turso CLI installed!

If you are a new user, you can sign up with turso auth signup.

If you already have an account, please login with turso auth login.

/usr/bin/xdg-open: line 881: www-browser: command not found
/usr/bin/xdg-open: line 881: links2: command not found
/usr/bin/xdg-open: line 881: elinks: command not found
/usr/bin/xdg-open: line 881: links: command not found
/usr/bin/xdg-open: line 881: lynx: command not found
/usr/bin/xdg-open: line 881: w3m: command not found
xdg-open: no method available for opening 'https://api.turso.tech/signup?port=36985&redirect=true&type=cli'
error: Unable to open browser.
Visit this URL on this device to log in:
https://api.turso.tech/signup?port=36985&redirect=true&type=cli
Waiting for authentication...
^C

but even the second try is bit confusing:

[penberg@turing ~]$ turso auth login --headless
Visit this URL on this device to log in:
https://api.turso.tech?redirect=false

The message is super confusing: I don't have a browser on the device turso is running on and it doesn't really give enough context about the steps.

Suggested fix:

  • Make the CLI fall back to headless mode if opening the browser fails.
  • Improve the headless help text to something sane.

When using the Turso CLI on Gitpod, It's a bit weirder even:

$ turso auth login

image

  • When I quit this, it outputs an URL that I can manually click and open.
  • The page I am shown let's me approve, and then redirects to a localhost:port/?jwc... URL.
  • As localhost:port is not a thing, I need to get the public URL that Gitpod created for it.
  • When I open / of that host in the browser (by e.g. clicking it in the list of open ports in GitPod), login process is unsuccessful because it is missing the expected parameters from the redirect.
  • When I only carefully copy the host, and then replace localhost:port in the URL I was redirected to after login, it works.