Stuck on "Waiting for session" when trying to use flyctl auth login

Environment:
Windows 10 + WSL2 (Ubuntu 20.04)

I install flyctl via the Linux instructions, and then run:

flyctl auth login
Waiting for session...⣟

This goes on forever. I assume some browser is supposed to start up and it’s not supported in WSL2 I guess. Can I sign in in some other way?

I’m able to log in with flyctl auth login on a WSL2 Ubuntu 20.04 instance.
flyctl auth login
ERROR Error opening browser. Copy the url https://fly.io/app/auth/cli/KEY into a browser and continue
Waiting for session…

I don’t know if supported is the right word, but it can work in WSL2.
What version of flyctl are you running (flyctl version to check)?

We’re trying to reproduce this, and it could be related to an issue in a package we use to open things: wsl support · Issue #29 · skratchdot/open-golang · GitHub

One thing that could be related is that I have Chrome installed inside WSL (for some headless scripting) - if your CLI tool tries to open Chrome inside WSL it will not work as there is no screen available.

I was able to work around this by running flyctl auth signup --verbose | tee temp and then reading the file temp to get the URL which I opened in my browser.

I had to do the extra tee step because the instant I ran flyctl auth signup --verbose the tool filled my screen with the letter W aside from the top line which said “Waiting on session.” So then I just opened another terminal and read the temp file to get the URL to open. Then I successfully authenticated.

I think it would be really nice if there was just an arg we could pass to the command to make it not do anything clever regarding the browser. My org administers everything on a centralized jumpbox that has no access to Web browsers etc., so it will never be able to start a browser.

For info, from flyctl version 286 and above, it should print the URL in the terminal.