I used a tool called aws-okta. It’s implemented in Go language. ‘login’ command will open generated URL in browser.
Environments where aws-okta login and aws-okta exec are known to work include:
The page above doesn’t say WSL as one of known to work env.
Indeed, it didn’t work. It complained about ‘xdg-open’ not found. I didn’t want to install this tool. This tool doesn’t have much value for WSL users. WSL has it’s own similar tool , for example wslstart, which will open specified file in appropriate Windows native app.
So, I searched alternative. Sadly, Go standard library doesn’t seem to read any environment variable for alternative browser(e.g. Firefox,Chrome) as the thread below shows.
there’s OS-specific ways to open things in a browser
So, I installed xdg-open with ‘sudo apt install’ . This is not the end of the story. I ended up using 2 environment variables like below.
$ sudo \ PATH="$PATH:/mnt/c/Program Files/Mozilla Firefox" \ BROWSER=firefox.exe \ ~/go/bin/aws-okta login my_profile [sudo] password for myWSLusername: Enter passphrase to unlock /home/myWSLusername/.aws-okta/: INFO Requesting MFA. Please complete two-factor authentication with your second device INFO Select a MFA from the following list INFO 0: OKTA (token:software:totp) INFO 1: OKTA (push) Select MFA method: 0 Enter MFA Code: abcdxxxxxxx
There’s related discussion below. But I don’t think the thread covers all solutions for various kinds of envs.
You can set the BROWSER variable.
Hope this helps some Windows mate!
Another workaround is to have aws-okta to spit out the generated URL on stdout.