n8n-Oidc
If you self-host n8n and want single sign-on, youâve probably discovered the harsh reality: SSO requires a Startup license that starts at $400/mo (billed annually). Thatâs a very significant cost, jus...
If you self-host n8n and want single sign-on, youâve probably discovered the harsh reality: SSO requires a Startup license that starts at $400/mo (billed annually). Thatâs a very significant cost, just to use your existing identity provider. This is the [SSO Tax](https://ssotax.org), and n8n is one of the worst offenders on the Wall of Shame at a 1567% markup over the base plan (and an obvious infinite markup over the self-hosted community edition).Today, Iâm releasing n8n-oidc â a drop-in solution that enables OpenID Connect authentication for self-hosted n8n, no enterprise license required.The problemYouâre running n8n self-hosted for yourself and maybe a couple of friends or family members. You already have an identity provider â maybe PocketID or Keycloak. You want your users to log in with their existing credentials, managed centrally with proper security controls, but n8n says no. Not unless you pay enterprise pricing.This isnât a technical limitation. SSO via OIDC is a straightforward, standardized protocol. The code to implement it is minimal. The real reason itâs locked behind enterprise pricing is because vendors know organizations *need* centralized authentication, and theyâre willing to exploit that need.As the folks at ssotax.org put it: âImagine buying a car and the manufacturer asks for an extra payment to unlock 100% of the braking power. Not offering security features if they already exist in your product means a vendor doesnât care about your security.âThe solutionn8n-oidc uses n8nâs external hooks system to inject OIDCc support at runtime. No patches, no forks, no license violations: just a javascript file and some environment variables.FeaturesStandard OIDC authorization code flow: works with any compliant identity providerJust-in-time user provisioning: Users are created automatically on first loginAutomatic role assignment: First user becomes owner, subsequent users become members.Clean login experience: SSO button replaces the default login form.Fallback access: Append ?showLogin=true for email/password login when neededHow it worksThe hooks.js file registers custom routes that handle the OIDC flow:/auth/oidc/login â Redirects users to your identity provider/auth/oidc/callback â Handles the authorization code exchange and creates the n8n session.A frontend script replaces the login form with a clean âSign in with SSOâ button. Users click it, authenticate with your IdP, and land in n8n fully authenticated with a proper session.Who is this for?Homelab enthusiasts who want proper authentication without enterprise pricingSmall teams self-hosting n8n who already have an identity providerOrganizations evaluating n8n who need SSO but canât justify enterprise costs for a proof-of-conceptAnyone who believes security features shouldnât be paywalledWho is this NOT for?If you need enterprise support, SLAs, or are running n8n at scale in a regulated environment, the enterprise license probably makes sense for you. This project is for the rest of us.Technical notesUses only built-in Node.js modules (no additional dependencies)Caches OIDC discovery documents for performanceImplements proper state/nonce validation to prevent CSRF and replay attacksCreates secure session cookies using n8nâs JWT serviceWorks with n8nâs Docker image out of the boxThe project is available on GitHub under the MIT license:github.com/cweagans/n8n-oidcIssues, PRs, and feedback welcome.