Skip to content
3 min read

fj auth

Manage authentication against Forgejo hosts

fj auth [OPTIONS] <COMMAND>

Every command also accepts the global flags: --host, --debug, --no-pager, --json-fields.

Options

  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj auth login

Authenticate with a Forgejo host. Stores the token in your OS keychain, or a 0600 file fallback

fj auth login [OPTIONS]

Options

  • --token <TOKEN> — Pass the token as a flag instead of through stdin / interactive prompt [env: FJ_TOKEN]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]
  • --with-token — Read the token from stdin (useful for piping cat token.txt | fj auth login --with-token)
  • --git-protocol <GIT_PROTOCOL> — Git protocol to use when cloning from this host [default: https][possible values: https, ssh]
  • --fjord — Sign in with Fjord Account credentials (email + password + optional TOTP) rather than a Forgejo personal access token. The resulting session bearer is used to talk to every Forgejo instance owned by this account, via the fjord-platform gateway. Use fj instances after signing in to list and pick an instance
  • --manual — Manual / no-browser sign-in for a Fjord Account on an SSO/OIDC deployment: instead of capturing the redirect on a local loopback listener (which only works when your browser is on the SAME machine as fj), print the sign-in URL, let you sign in on ANY device, and paste the redirected URL (or the bare code) back. Use this when fj runs on a remote server or your browser is on a separate device (e.g. an iPad). Fjord mode only [aliases: –no-browser]
  • --device — Durable cross-device sign-in for a Fjord Account on an SSO/OIDC deployment via the OAuth 2.0 Device Authorization Grant (RFC 8628). fj shows a short code and a link (plus a scannable QR code); you open it on ANY device (phone, iPad, another laptop), approve, and fj picks up the session automatically (no loopback, no copy-paste). This is the durable replacement for --manual when your browser is on a different device than fj, and it’s auto-selected on a headless / SSH session. Fjord mode only
  • --platform-url <URL> — fjord-platform deployment URL to sign in against. Defaults to the production deployment. Use this for local dev (http://localhost:5180) or to point at a staging environment

fj auth status

Show which hosts you’re signed in to

fj auth status [OPTIONS]

Options

  • --show-token — Show the token (still doesn’t read it from disk; pulled from keychain)
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj auth logout

Forget the token for a host

fj auth logout [OPTIONS]

Options

  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj auth list

List configured hosts

fj auth list [OPTIONS]

Options

  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj auth switch

Set the default host for commands that omit --host

fj auth switch [OPTIONS] <HOST>

Arguments

  • <HOST> — Hostname to make the new default

Options

  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj auth token

Print the stored token for a host (for scripting)

fj auth token [OPTIONS]

Options

  • --force — Print the token even if stdout is a terminal (default refuses to, to avoid accidental shoulder-surfing in shell history)
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj auth refresh

Re-verify the stored token. Replaces it if a new one is given

fj auth refresh [OPTIONS]

Options

  • --token <TOKEN> — Replace the stored token. If omitted, fj just re-verifies the existing one
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]
  • --with-token — Read replacement token from stdin

fj auth session

Import a Forgejo web session cookie for the cookie-gated Actions log and rerun routes (a PAT is rejected there; see fj#103)

fj auth session [OPTIONS]

Options

  • --cookie <COOKIE> — The i_like_gitea session cookie value, copied from a signed-in browser. Prefer --with-cookie (stdin) to keep it out of shell history [env: FJ_SESSION]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]
  • --with-cookie — Read the cookie value from stdin
  • --clear — Forget the stored session for the host instead of importing one

fj auth setup-git

Install a git credential helper that uses fj’s stored token

fj auth setup-git [OPTIONS]

Options

  • --dry-run — Print the recommended git config commands without applying them
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]
Contributors
  • Stephen Way