cloudentity / oauth2c

User-friendly OAuth2 CLI
https://cloudentity.github.io/oauth2c/
Apache License 2.0
741 stars 29 forks source link

Unable to use oauth2c on an Ubuntu GitHub Actions runner #85

Closed timsearle closed 4 months ago

timsearle commented 11 months ago

When trying to use oauth2c on a GitHub Actions Ubuntu runner, having installed via:

curl -sSfL https://raw.githubusercontent.com/cloudentity/oauth2c/master/install.sh | \
sudo sh -s -- -b /usr/local/bin latest

The command times out due to:

/usr/bin/xdg-open: 882: www-browser: not found
/usr/bin/xdg-open: 882: links2: not found
/usr/bin/xdg-open: 882: elinks: not found
/usr/bin/xdg-open: 882: links: not found
/usr/bin/xdg-open: 882: lynx: not found
/usr/bin/xdg-open: 882: w3m: not found

The runner images already come with Chrome and other browsers installed - https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md

When using the macos-latest runner and installing via Homebrew, oauth2c works correctly. Given the 10x multiplier for macOS Github Action runners it would be ideal for oauth2c to work correctly on an Ubuntu runner. I attempt to install lynx and elinks on the runner, but still had issues with timeouts.

mbilski commented 11 months ago

Hi @timsearle

In https://github.com/cloudentity/oauth2c/pull/86 I switched from https://github.com/pkg/browser to https://github.com/cli/browser

The pkg/browsers seems dead.

From https://github.com/cli/browser/blob/main/.github/workflows/push.yml it looks like the cli/browsers works fine on ubuntu-latest, macos-latest and windows-latest.

Could you give it a try?

timsearle commented 11 months ago

Thanks for the fast response.

Looking at the workflow runs of the workflow you shared:

https://github.com/cli/browser/actions/runs/6420384478/job/17432344727

Doesn't actually look like it's executing any tests that would verify OpenURL works.

I was still getting the same issue as before, despite using the new version you've released, but by adding:

sudo apt-get install -y links

I'm able to get xdg-open to work on the CI, which is good news. Unclear why it's not working with Firefox when that's the default browser the CI seems to have when querying with xdg-mime query default x-scheme-handler/http.

However - the callback for the request never makes it back to oauth2c. I'm unclear whether something is going wrong in the browser, or if the HTTP server listening on 9876 is not running.

I've verified the command I'm performing works locally on my machine with no interaction with the browser required and it calls back to oauth2c.

Any thoughts on next steps to try?

mbilski commented 11 months ago

@timsearle have you tried setting the BROWSER env var to firefox? sth like BROWSER=/usr/bin/firefox

timsearle commented 11 months ago

I'll give that a go soon - I ended up writing my own script for now to perform the auth flows I needed, but I will see if I can figure out why i couldn't get oauth2c working on the Ubuntu runner.