forgejo-contrib-forgejo-cli-issues-263.md
Watch20
Star402
Fork
You've already forked forgejo-cli
CodeIssues 44Pull requests 8Releases 11Packages 2WikiActivity
Closed
opened 2026-01-11 10:41:53 +01:00 by hedefalk · 6 comments
hedefalk commented 2026-01-11 10:41:53 +01:00
Copy link
Create an OAuth application on my Forgejo instance
Add the client ID to the config file:
Also tried ~/Library/Application Support/Cyborus/forgejo-cli/client_ids
Run fj auth login --host forge.example.com
OAuth login flow starts
Your installation of fj doesn't support `login` for forge.example.com
Please visit https://forge.example.com/user/settings/applications
to create a token, and use it to log in with `fj auth add-key`
Building with BUILTIN_CLIENT_IDS environment variable works:
pkgs.forgejo-cli.overrideAttrs (old: {
BUILTIN_CLIENT_IDS = "forge.example.com CLIENT_ID_HERE";
});
Cyborus/forgejo-cli/client_ids and /etc/fj/client_ids~/Library/Application Support/Cyborus/forgejo-cli/client_ids 4. Run fj auth login --host forge.example.com ## Expected OAuth login flow starts ## Actual Your installation of fj doesn't support login for forge.example.com Please visit https://forge.example.com/user/settings/applications to create a token, and use it to log in with fj auth add-key ## Workaround Building with BUILTIN_CLIENT_IDS environment variable works: pkgs.forgejo-cli.overrideAttrs (old: { BUILTIN_CLIENT_IDS = "forge.example.com CLIENT_ID_HERE"; }); ## Notes - The binary contains strings referencing both Cyborus/forgejo-cli/client_ids and /etc/fj/client_ids - Neither location seems to be read on macOS - Documentation only mentions Linux and Windows paths, not macOShedefalk commented 2026-01-11 10:54:40 +01:00
Author
Copy link
To clarify, the only way I got auth working against my self-hosted forgejo was by building the forgejo-cli binary myself with the nix override:
{
description = "My projects dev environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{ self, nixpkgs }:
let
# systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
systems = ["aarch64-darwin"];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
in
{
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
forgejo-cli = pkgs.forgejo-cli.overrideAttrs (old: {
BUILTIN_CLIENT_IDS = "forge.[mydomain].se [redacted]";
});
}
);
};
}
I guess this was fine right now because I put the flake in a direnv based devbox per project folder so this fj will only have to work against this particular self-hosted forgejo instance BUT I'd much rather have forgejo-cli in my nix-darwin global dotfiles setup once-and-forall and now I'd have to then look up all the official client_ids first or I wouldn't be able to auth against codeberg.org etc, right?
To clarify, the only way I got auth working against my self-hosted forgejo was by building the forgejo-cli binary myself with the nix override: nix { description = "My projects dev environment"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; outputs = { self, nixpkgs }: let # systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; systems = ["aarch64-darwin"]; forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system); in { packages = forAllSystems ( system: let pkgs = nixpkgs.legacyPackages.${system}; in { forgejo-cli = pkgs.forgejo-cli.overrideAttrs (old: { BUILTIN_CLIENT_IDS = "forge.[mydomain].se [redacted]"; }); } ); }; } I guess this was fine right now because I put the flake in a direnv based devbox per project folder so this fj will only have to work against this particular self-hosted forgejo instance BUT I'd much rather have forgejo-cli in my nix-darwin global dotfiles setup once-and-forall and now I'd have to then look up all the official client_ids first or I wouldn't be able to auth against codeberg.org etc, right?
Cyborus commented 2026-01-11 14:46:12 +01:00
Member
Copy link
@hedefalk wrote in #263 (comment):
- Also tried
~/Library/Application Support/Cyborus/forgejo-cli/client_ids
I believe this should be Cyborus.forgejo-cli instead of Cyborus/forgejo-cli. Does that work?
@hedefalk wrote in https://codeberg.org/forgejo-contrib/forgejo-cli/issues/263#issue-3195509: > 3. Also tried ~/Library/Application Support/Cyborus/forgejo-cli/client_ids I believe this should be Cyborus.forgejo-cli instead of Cyborus/forgejo-cli. Does that work?
hedefalk commented 2026-01-11 15:45:56 +01:00
Author
Copy link
I believe this should be
Cyborus.forgejo-cliinstead ofCyborus/forgejo-cli. Does that work?
Oh, yes, that worked, thanks!
Would it be reasonable to look in ~/.config/forgejo-cli first on MacOs too?
> I believe this should be Cyborus.forgejo-cli instead of Cyborus/forgejo-cli. Does that work? Oh, yes, that worked, thanks! Would it be reasonable to look in ~/.config/forgejo-cli first on MacOs too?
Cyborus commented 2026-01-11 16:09:53 +01:00
Member
Copy link
@hedefalk wrote in #263 (comment):
Would it be reasonable to look in ~/.config/forgejo-cli first on MacOs too?
Is that directory commonly used on MacOS? The system directory library I'm using doesn't list it.
@hedefalk wrote in https://codeberg.org/forgejo-contrib/forgejo-cli/issues/263#issuecomment-9737528: > Would it be reasonable to look in ~/.config/forgejo-cli first on MacOs too? Is that directory commonly used on MacOS? The system directory library I'm using doesn't list it.
hedefalk commented 2026-01-11 16:46:38 +01:00
Author
Copy link
Is that directory commonly used on MacOS? The system directory library I'm using doesn't list it.
It's a little funky - normal desktop apps typically use those ~/Library/Application\ Support/ folders - that's the "macos way" I guess, but common cli tools in general augment this with more posix typical locations. For instance - this is verbatim from my dotfiles repo:
file = {
# ".config/fish/config.fish".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/fish/config.fish";
".config/wezterm".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/wezterm";
# ".config/zed/themes".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/fish/.config/zed/themes";
# ".config/zed/settings.json".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/zed/settings.json";
".config/zed/keymap.json".source =
config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/zed/keymap.json";
".config/git/config".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/git/.gitconfig";
".gitignore".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/git/.gitignore";
"scripts".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/scripts";
".config/starship.toml".source =
config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/starship.toml";
".config/fish/functions".source =
config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/fish/functions";
"Library/Application\ Support/Cyborus.forgejo-cli/client_ids".source =
config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/forgejo-cli/client_ids";
};
I'd consider forgejo-cli to be in the family of cli tools that should look in ~/.config before "Application Support", the latter is more for desktop apps I think…?
The system directory library I'm using doesn't list it.
That's interesting, I might be way off here, but I really don't think so considering the samples I just posted above ^. I mean even desktop apps like zed and wezterm look in ~/.config. What library is that?
>Is that directory commonly used on MacOS? The system directory library I'm using doesn't list it. It's a little funky - normal desktop apps typically use those ~/Library/Application\ Support/ folders - that's the "macos way" I guess, but common cli tools in general augment this with more posix typical locations. For instance - this is verbatim from my dotfiles repo: file = { # ".config/fish/config.fish".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/fish/config.fish"; ".config/wezterm".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/wezterm"; # ".config/zed/themes".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/fish/.config/zed/themes"; # ".config/zed/settings.json".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/zed/settings.json"; ".config/zed/keymap.json".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/zed/keymap.json"; ".config/git/config".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/git/.gitconfig"; ".gitignore".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/git/.gitignore"; "scripts".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/scripts"; ".config/starship.toml".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/starship.toml"; ".config/fish/functions".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/fish/functions"; "Library/Application\ Support/Cyborus.forgejo-cli/client_ids".source = config.lib.file.mkOutOfStoreSymlink "${dotfilesPath}/forgejo-cli/client_ids"; }; I'd consider forgejo-cli to be in the family of cli tools that should look in ~/.config before "Application Support", the latter is more for desktop apps I think…? >The system directory library I'm using doesn't list it. That's interesting, I might be way off here, but I really don't think so considering the samples I just posted above ^. I mean even desktop apps like zed and wezterm look in ~/.config. What library is that?
Cyborus commented 2026-01-11 16:58:44 +01:00
Member
Copy link
@hedefalk wrote in #263 (comment):
What library is that?
With so many examples though, I'm open to supporting it
@hedefalk wrote in https://codeberg.org/forgejo-contrib/forgejo-cli/issues/263#issuecomment-9738569: > What library is that? The directories crate With so many examples though, I'm open to supporting it
❤️ 1
Cyborus referenced this issue from a pull request that will close it, 2026-01-15 01:06:00 +01:00
feat(login): support client ids in ~/.config on macos #274
Cyborus closed this issue 2026-01-15 01:55:39 +01:00
Cyborus referenced this issue from a commit 2026-01-15 01:55:39 +01:00
feat(login): support client ids in ~/.config on macos
Sign in to join this conversation.
No Branch/Tag specified
main
renovate/lock-file-maintenance
renovate/serde-saphyr-0.x
docs/contributing
no-port-in-refspec
login/v16.next.forgejo.org
crates-io-publish
0.5.x
compile-time-fluent
0.4.x
localization-alias-demo
api_url_field
v0.5.0
v0.4.1
v0.4.0
v0.3.0
v0.2.0
v0.1.1
v0.1.0
v0.0.4
v0.0.3
v0.0.2
v0.0.1
Labels
Clear labels[ Kind/Breaking Breaking change that won't be backward compatible
](#)[ Kind/Bug Something is not working
](#)[ Kind/Design Discussion about UI/UX design
](#)[ Kind/Documentation Documentation changes
](#)[ Kind/Enhancement Improve existing functionality
](#)[ Kind/Feature New functionality
](#)[ Kind/Security This is security issue
](#)[ Kind/Testing Issue or pull request related to testing
](#)[ Kind/Upstream This is an issue with upstream software (Forgejo) that is probably not our fault
](#)
[ Priority
Critical The priority is critical
](#)[ Priority
High The priority is high
](#)[ Priority
Low The priority is low
](#)[ Priority
Medium The priority is medium
](#)
[ Reviewed
Confirmed Issue has been confirmed
](#)[ Reviewed
Duplicate This issue or pull request already exists
](#)[ Reviewed
Invalid Invalid issue
](#)[ Reviewed
Won't Fix This issue won't be fixed
](#)
[ Status
Abandoned Somebody has started to work on this but abandoned work
](#)[ Status
Blocked Something is blocking this issue or pull request
](#)[ Status
Need More Info Feedback is required to reproduce issue or to continue work
](#)
[ Suspicious
](#)
No labels Kind/Breaking Kind/Bug Kind/Design Kind/Documentation Kind/Enhancement Kind/Feature Kind/Security Kind/Testing Kind/Upstream [ Priority
Critical ](/forgejo-contrib/forgejo-cli/issues?labels=173012) [ Priority
High ](/forgejo-contrib/forgejo-cli/issues?labels=173013) [ Priority
Low ](/forgejo-contrib/forgejo-cli/issues?labels=173015) [ Priority
Medium ](/forgejo-contrib/forgejo-cli/issues?labels=173014) [ Reviewed
Confirmed ](/forgejo-contrib/forgejo-cli/issues?labels=173007) [ Reviewed
Duplicate ](/forgejo-contrib/forgejo-cli/issues?labels=173005) [ Reviewed
Invalid ](/forgejo-contrib/forgejo-cli/issues?labels=173006) [ Reviewed
Won't Fix ](/forgejo-contrib/forgejo-cli/issues?labels=173008) [ Status
Abandoned ](/forgejo-contrib/forgejo-cli/issues?labels=173011) [ Status
Blocked ](/forgejo-contrib/forgejo-cli/issues?labels=173010) [ Status
Need More Info ](/forgejo-contrib/forgejo-cli/issues?labels=173009) Suspicious
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
Notifications Subscribe
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
forgejo-contrib/forgejo-cli#263
WritePreview
Loading…
Add table
| Rows | | | Columns | |
CancelOK
Add a link
Url Description Hint: With a URL in your clipboard, you can paste directly into the editor to create a link.
CancelOK
CancelSave
Reference in a new issue
Repository
forgejo-contrib/forgejo-cli
Title
Body
Create issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
No Yes