Skip to content

triauth for HedgeDocOIDC

Let your team open HedgeDoc with one approval on their own device, and no HedgeDoc passwords.

  • Notes and docs
  • Open source
Sign-in through
OpenID Connect bridge
Available in
HedgeDoc 1.2 and newer
Set up in
Environment variables

About HedgeDoc

HedgeDoc is a web page where several people write the same text at the same time, with Markdown formatting. Teams use it for meeting notes, drafts, documentation, and simple slide decks, on a server of their own.

Connect HedgeDoc to triauth

HedgeDoc signs people in through the triauth OpenID Connect bridge, set up as its OAuth2 login. Once connected, the sign-in dialog shows a Sign in via button carrying your domain's name. People on your team click it, type their username, and approve on their own device. Nobody keeps a HedgeDoc password, and when someone leaves, removing their identity records at your domain ends their access to HedgeDoc as well.

How it works

  1. Open oidc.triauth.org and enter your domain. Paste HedgeDoc's redirect address, https://notes.example.com/auth/oauth2/callback with your own HedgeDoc address in place of notes.example.com, and click Connect app. The bridge gives you a client ID and a client secret.

  2. Add the settings below to HedgeDoc's environment and restart it. Replace example.com with your domain and the two placeholders with the client ID and the client secret from the bridge.

    ini
    CMD_OAUTH2_PROVIDERNAME=example.com
    CMD_OAUTH2_AUTHORIZATION_URL=https://oidc.triauth.org/example.com/authorize
    CMD_OAUTH2_TOKEN_URL=https://oidc.triauth.org/example.com/token
    CMD_OAUTH2_USER_PROFILE_URL=https://oidc.triauth.org/example.com/userinfo
    CMD_OAUTH2_CLIENT_ID=<client ID from the bridge>
    CMD_OAUTH2_CLIENT_SECRET=<client secret from the bridge>
    CMD_OAUTH2_SCOPE=openid email profile
    CMD_OAUTH2_USER_PROFILE_ID_ATTR=sub
    CMD_OAUTH2_USER_PROFILE_USERNAME_ATTR=preferred_username
    CMD_OAUTH2_USER_PROFILE_DISPLAY_NAME_ATTR=name
    CMD_OAUTH2_USER_PROFILE_EMAIL_ATTR=email
  3. Open HedgeDoc, click Sign in, and choose Sign in via example.com.

Checkpoint

HedgeDoc's sign-in dialog shows a Sign in via button with your domain's name. 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

  • Everyone with an identity at your domain gets a HedgeDoc account the first time they sign in. To let only one team in, limit the app to a group when you connect it, or name the group in CMD_OAUTH2_ACCESS_ROLE with CMD_OAUTH2_ROLES_CLAIM=groups.
  • HedgeDoc knows people by the sign-in method they used, so accounts created with a password or another login are not merged.
  • The upcoming HedgeDoc 2 replaces these settings with a native OpenID Connect setup.

For the person who connects the app

SettingValue
Redirect addresshttps://<your-hedgedoc>/auth/oauth2/callback
Where in HedgeDocenvironment variables, or the oauth2 object in config.json
Addressesthe authorization, token, and userinfo addresses go in one by one, as above, since HedgeDoc 1 does not read the discovery document
ClaimsHedgeDoc reads everything from the userinfo response, with sub as the stable ID
PKCEoptional, CMD_OAUTH2_PKCE=true

HedgeDoc keeps the client secret, so leave This app can't keep a secret unticked when you connect it on the bridge. HedgeDoc's configuration reference lists every variable.

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.