oauth2c icon indicating copy to clipboard operation
oauth2c copied to clipboard

Unable to use oauth2c on an Ubuntu GitHub Actions runner

Open timsearle opened this issue 2 years ago • 4 comments

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.

timsearle avatar Nov 01 '23 22:11 timsearle

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?

mbilski avatar Nov 02 '23 10:11 mbilski

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?

timsearle avatar Nov 02 '23 21:11 timsearle

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

mbilski avatar Nov 08 '23 08:11 mbilski

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.

timsearle avatar Nov 08 '23 22:11 timsearle