Skip to content

triauth for ForgejoOIDC

Let your team sign in to your Forgejo with one approval on their own device, and no Forgejo passwords.

  • Code and DevOps
  • Open source
Sign-in through
OpenID Connect bridge
Available in
Every Forgejo installation
Set up in
Site administration › Identity & access › Authentication sources

About Forgejo

Forgejo is self-hosted software for keeping source code, tracking issues, and reviewing changes, run on your own server. It is developed by an independent community and is the software behind Codeberg.

Connect Forgejo to triauth

Forgejo signs people in through the triauth OpenID Connect bridge. Once connected, Forgejo's sign-in page shows a Sign in with triauth button. People on your team click it, type their username, and approve on their own device. Nobody keeps a Forgejo password, and when someone leaves, removing their identity records at your domain ends their access to Forgejo as well.

How it works

  1. In Forgejo, open Site administration › Identity & access › Authentication sources and add a source of the type OAuth2 with the provider OpenID Connect. Name it triauth.
  2. Open oidc.triauth.org and enter your domain. Paste Forgejo's redirect address, https://forgejo.example.com/user/oauth2/triauth/callback with your own Forgejo address in place of forgejo.example.com, and click Connect app. The bridge gives you a client ID and a client secret.
  3. Back in Forgejo, paste the client ID and the client secret. As the auto discovery URL, enter https://oidc.triauth.org/example.com/.well-known/openid-configuration with your domain in place of example.com, and add profile email groups as additional scopes. Save the source.
  4. Open Forgejo's sign-in page and click Sign in with triauth.

Checkpoint

Forgejo's sign-in page shows a Sign in with triauth button. Choosing it opens a page from the bridge that asks for the username, and the person's authenticator asks them to approve.

Good to know

  • The name you give the source becomes part of the redirect address and of the button, so pick it before you connect the app on the bridge.
  • By default, a person who signs in for the first time is asked to register or to connect an existing Forgejo account with its password. If new people should get an account at once, the person who connects the app turns on automatic registration.
  • Forgejo can give admin rights, or membership of organization teams, by the groups published at your domain.

For the person who connects the app

SettingValue
Redirect addresshttps://<your-forgejo>/user/oauth2/<source name>/callback
Where in ForgejoSite administration › Identity & access › Authentication sources › Add authentication source, type OAuth2, provider OpenID Connect
Discovery URLhttps://oidc.triauth.org/<your domain>/.well-known/openid-configuration
Additional scopesprofile email groups, since Forgejo adds only openid by itself
Groups"Claim name providing group names" is groups, then the admin and restricted group values and the team map
New accountsENABLE_AUTO_REGISTRATION in the [oauth2_client] section of app.ini. New usernames come from preferred_username, the person's username, through the default USERNAME = nickname

Forgejo keeps the client secret, so leave This app can't keep a secret unticked when you connect it on the bridge. Forgejo's OIDC group mappings guide and the configuration cheat sheet explain the fields.

Next steps

All logos and trademarks belong to their respective owners and do not imply affiliation or endorsement of the organization or product by triauth, nor vice versa. The content provided on this page may include information from third-party sources. We do not assume any responsibility for the completeness, correctness, or applicability of the information. You should independently verify any details before relying on them.