hickford/git-credential-oauth

OAuth becomes stuck when Firefox is started without .cache/mozilla folder, Needs to be manually closed

Closed this issue · 3 comments

I have been using git-credential-oauth on NixOS + Hyprland + Impermanence for quite some time now. Because of impermanence, everyday I boot my pc, the ~/.cache/mozilla directory is wiped and regenerated. At this point, I have not opened Firefox yet. The first thing I do is cd to a git repo and git fetch. git-credential-oauth then performs xdg-open (using xdph as normal, but then Firefox becomes stuck. I had to Ctrl-c the git fetch, open Firefox, and perform git fetch again.

Until today, I alt-f4 Firefox instead of my terminal, and the oauth ran to completion. Never did I suspect that an empty .cache/mozilla was one of the culprits to this problem. By removing the .cache/mozilla folder I can reliably reproduce the issue.

Steps:

  1. git credential-cache exit
  2. rm or mv ~/.cache/mozilla
  3. Perform git fetch on any git repo
  4. Observe that the Firefox window is stuck,
  5. Alt-F4 the firefox window, the oauth process runs to completion
  6. git credential-cache exit again
  7. Manually start Firefox
  8. git fetch again
  9. this time with ~/.cache/mozilla already present, the oauth does not become stuck
output.mp4

Additional Notes:

  • I tried to workaround this isue by adding ~/.cache/mozilla into my persistent directory. It did not help. The problem is still present.
  • Problem does not appear in GNOME when repeating the above steps

Can you reproduce the problem with xdg-open https://example.com? I'm not sure this can be fixed in git-credential-oauth.

@ComputeDragon CC @hickford I got the same issue here sometimes with my Fedora box when activating my VPN
I guess it's because the oauth callback is pointing to a URL like this : https://127.0.0.1:XXX/YYY

ksnip_20241217-143751

github.com URL is using "real" https and is actually secure, but the redirect url is pointing to your localhost. ;-)
If you cleared your cache, you can open a new tab and open a dummy https://127.0.0.1 for example to grant again Firefox access to your localhost. That should work.

Of course you might need to restart Firefox or you GIT App (SourceGit in my case) if need be but that would do the trick.

Video was great, well explained and straight to the point 👍
I'm gonna stick with static pixels, here are a few additional screenshots :

ksnip_20241217-144607

ksnip_20241217-144611

ksnip_20241217-144614

ksnip_20241217-144619

Thanks again for this wonderful oauth feature 🥇 , and have a wonderful day both of you 💯

Nope, I am unable to reproduce with xdg-open https://example.com After clearing cache, Firefox opens example.com just fine. I suspect this rabbit hole is gonna go deep and is out oy my element, so I will just live with it.