Bad GitHub credentials

I suspect this is something to do with my setup existing on the beta and getting into a weird state but when I attempt to update, I’m getting a bad credentials exception from the GitHub API calls.

Suspecting this was similar to GitHub API 401 when running `flox activate`, I relogged with gh auth but to no avail.

$ gh auth login
? What account do you want to log into? GitHub.com
? You're already logged into github.com. Do you want to re-authenticate? Yes
? What is your preferred protocol for Git operations? HTTPS
? Authenticate Git with your GitHub credentials? Yes
? How would you like to authenticate GitHub CLI? Login with a web browser

! First copy your one-time code: 04C8-D0F7
Press Enter to open github.com in your browser...
✓ Authentication complete.
- gh config set -h github.com git_protocol https
✓ Configured git protocol
✓ Logged in as jacobbednarz

$ flox pull -e flox/default
Updating /Users/jacob/.config/flox/nix.conf
Already on 'x86_64-darwin.default'
Your branch is up to date with 'origin/x86_64-darwin.default'.
Everything up-to-date
error: unable to download 'https://api.github.com/repos/flox/capacitor/tarball/3a1505cf9f13f6e44c882d9f3c69dcafbd0462e1': HTTP error 401

       response body:

       {
         "message": "Bad credentials",
         "documentation_url": "https://docs.github.com/rest"
       }
(use '--show-trace' to show detailed location information)
error: unable to download 'https://api.github.com/repos/flox/nixpkgs-flox/tarball/bc44d6d77530ff0f5d7cdf28b4d8feb37bc8af70': HTTP error 401

       response body:

       {
         "message": "Bad credentials",
         "documentation_url": "https://docs.github.com/rest"
       }
(use '--show-trace' to show detailed location information)
error: unable to download 'https://api.github.com/repos/flox/nixpkgs-flox/tarball/bc44d6d77530ff0f5d7cdf28b4d8feb37bc8af70': HTTP error 401

       response body:

       {
         "message": "Bad credentials",
         "documentation_url": "https://docs.github.com/rest"
       }
(use '--show-trace' to show detailed location information)
error: unable to download 'https://api.github.com/repos/flox/nixpkgs-flox/tarball/bc44d6d77530ff0f5d7cdf28b4d8feb37bc8af70': HTTP error 401

       response body:

       {
         "message": "Bad credentials",
         "documentation_url": "https://docs.github.com/rest"
       }
(use '--show-trace' to show detailed location information)

I also tried removing access-tokens from /Users/jacob/.config/flox/nix.conf just in case there were some stale tokens in there as well as gh auth logout.

Ok, like all good issues, I just reinstalled using the following and now is all working

$ nix profile install --impure \
  'github:flox/floxpkgs#flox.fromCatalog'

Chalking this one up to beta/stable release conflicts.

2 Likes

ah, yes - a reinstall would indeed be required. On 2 Feb we made an “upgrade announcement” to everyone who had subscribed to our newsletter mailing list (in order to reach as many users as we could) recommending all to update to the latest flox version as soon as possible, noting that if they missed the upgrade, a reinstall would likely be required. Granted, we didn’t give more than a few days notice… While we couldn’t say at the time, it was all related to us being able to launch the flox CLI to open source. :partying_face:

As an aside, if you haven’t subscribed to our newsletter and would like to, there is a box at the bottom of all our webpages on floxdev.com where you can do so.