triauth for OAuth2 ProxyOIDC
Let your team reach the tools behind OAuth2 Proxy with one approval on their own device, and no passwords anywhere.
- Sign-in through
- OpenID Connect bridge
- Available in
- Every OAuth2 Proxy installation
- Set up in
- Flags or environment variables
About OAuth2 Proxy
OAuth2 Proxy is a small server you put in front of a web application, or behind Nginx or Traefik, so that nobody reaches the application without signing in first. It handles the sign-in, keeps a session cookie, and passes the person's email address and groups to the application in headers. Operations teams use it to protect dashboards and internal tools that have no login of their own.
Connect OAuth2 Proxy to triauth
OAuth2 Proxy signs people in through the triauth OpenID Connect bridge. Once connected, anyone opening a protected tool sees a Sign in with button with your domain's name. People on your team click it, type their username, and approve on their own device. The tool behind the proxy never sees a password, and when someone leaves, removing their identity records at your domain ends their access to all of it.
How it works
Open oidc.triauth.org and enter your domain. Paste the proxy's redirect address,
https://app.example.com/oauth2/callbackwith the address people use for the protected app in place ofapp.example.com, and click Connect app. The bridge gives you a client ID and a client secret.Start OAuth2 Proxy with the settings below. Replace
example.comwith your domain,app.example.comwith the app's address, the two placeholders with the client ID and the client secret from the bridge, and the cookie secret with a random value of your own.iniOAUTH2_PROXY_PROVIDER=oidc OAUTH2_PROXY_OIDC_ISSUER_URL=https://oidc.triauth.org/example.com OAUTH2_PROXY_CLIENT_ID=<client ID from the bridge> OAUTH2_PROXY_CLIENT_SECRET=<client secret from the bridge> OAUTH2_PROXY_REDIRECT_URL=https://app.example.com/oauth2/callback OAUTH2_PROXY_SCOPE=openid email profile groups offline_access OAUTH2_PROXY_COOKIE_REFRESH=30m OAUTH2_PROXY_EMAIL_DOMAINS=example.com OAUTH2_PROXY_CODE_CHALLENGE_METHOD=S256 OAUTH2_PROXY_PROVIDER_DISPLAY_NAME=example.com OAUTH2_PROXY_COOKIE_SECRET=<a random secret of 32 bytes> OAUTH2_PROXY_UPSTREAMS=http://127.0.0.1:8080/Open the protected app and click Sign in with example.com.
Checkpoint
The proxy's sign-in page shows Sign in with example.com. Choosing it opens a page from the bridge that asks for the username, and the person's authenticator asks them to approve. The app opens afterwards.
Good to know
- OAuth2 Proxy keeps no accounts. Everyone with an identity at your domain gets in, and
OAUTH2_PROXY_ALLOWED_GROUPSnarrows that to the members of one of the groups published at your domain. You can also limit the app to a group when you connect it. - The app behind the proxy learns who signed in from headers such as
X-Auth-Request-EmailandX-Auth-Request-Groups, whenOAUTH2_PROXY_SET_XAUTHREQUEST=true. - With the settings above, the proxy renews the sign-in through the bridge every half hour while a person works, and re-reads their groups each time. So a session follows the identity. When someone's records at your domain go away, the next renewal sends them to the sign-in page.
For the person who connects the app
| Setting | Value |
|---|---|
| Redirect address | https://<the protected host>/oauth2/callback, also set as OAUTH2_PROXY_REDIRECT_URL |
| Where | flags, OAUTH2_PROXY_* environment variables, or a TOML configuration file |
| Issuer | OAUTH2_PROXY_OIDC_ISSUER_URL takes https://oidc.triauth.org/<your domain>, and the rest comes from the discovery document |
| Sessions | OAUTH2_PROXY_COOKIE_REFRESH=30m renews the sign-in through the bridge every half hour. OAUTH2_PROXY_COOKIE_EXPIRE, usually a week, is how long an unused session is kept, and the refresh period must stay below it. The proxy's docs ask for that expiry to match how long the bridge keeps an unused session. A bridge error at a renewal sends the person to sign in again |
| Nonce | OAUTH2_PROXY_INSECURE_OIDC_SKIP_NONCE=false turns the nonce check on, which the bridge supports |
| Behind Nginx or Traefik | the auth_request and ForwardAuth setups use the proxy's /oauth2/auth endpoint and need OAUTH2_PROXY_REVERSE_PROXY=true |
OAuth2 Proxy keeps the client secret, so leave This app can't keep a secret unticked when you connect it on the bridge. OAuth2 Proxy's OpenID Connect page and the configuration overview list every flag.
Next steps
- Read the OpenID Connect bridge page for what every connected app gets and what the bridge keeps private.
- Read Roll out to your team to give everyone in your organization an identifier at your domain.
- Read Groups to publish the groups that the proxy lets through.
- Read OAuth2 Proxy's OpenID Connect page for every setting the proxy offers.
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.