211 days ago · Tech · hide · Fediverse post

Because I refuse to log in twiceI use ForwardAuth for most of my self-hosted services, as it’s much more convenient than configuring authentication for each application individually. n8n doesn’t support this out of the box, but we can leverage External Hooks to add this functionality. By using the EXTERNAL_HOOK_FILES environment variable, we can load a custom script to enable ForwardAuth. const fs = require("fs"); const { resolve } = require("path"); const n8nBasePath = "@N8N_BASE_PATH@"; const pnpmDir = resolve(n8nBasePath, "node_modules/.pnpm"); const routerDir = fs .readdirSync(pnpmDir) .find((dir) => dir.startsWith("router@")); const Layer = require( resolve(pnpmDir, routerDir, "node_modules/router/lib/layer"), ); const { issueCookie } = require( resolve(n8nBasePath, "packages/cli/dist/auth/jwt"), ); const ignoreAuthRegexp = /^\/(assets|healthz|webhook|rest\/oauth2-credential)/; module.exports = { n8n: { ready: [ async function({ app }, config) { const { stack } = app.router;…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town