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)?
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.
I’m getting the url in the console but when I click on it the resulting web page says “Error! CLI Session Expired, please restart the process” even though less than 5 seconds has transpired between the url showing and opening the page.
console:
$ flyctl auth login
failed opening browser. Copy the url (https://fly.io/app/auth/cli/447462f72b97a737458c490fa0e19095) into a browser and continue
Opening https://fly.io/app/auth/cli/447462f72b97a737458c490fa0e19095 ...
figured it out: I’m using Wezterm which makes urls in console clickable, and it’s including the trailing parenthesis in the url: https://fly.io/app/auth/cli/447462f72b97a737458c490fa0e19095)
Arguably this is a wezterm parsing issue, but I suggest adding space padding to the url anyway as manual copy-paste is likely to often do the same thing too.