Automate OIDC Client Authentication with n8n Workflow

This n8n workflow automates OpenID Connect (OIDC) client authentication, managing token exchange and user info retrieval seamlessly. It solves the challenge of integrating OIDC authentication flows with minimal coding and setup by automating token handling and user sessions.
webhook
code
httpRequest
+5
Workflow Identifier: 1984
NODES in Use: Webhook, Code, HTTP Request, If, Set, Respond to Webhook, HTML, Sticky Note

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Workflow Does

This workflow handles OpenID Connect client login automatically in n8n.

It solves the hard parts of token handling and getting user info from the identity provider.

When you use it, users can log in via your OIDC server without writing code.


Who Should Use This Workflow

This is for people who want to add secure login using OIDC without deep coding.

It works well for developers who run n8n workflows and want an easy OIDC client setup.


Tools and Services Used

  • n8n Workflow Editor: To build and run the automation.
  • OIDC Identity Provider: Like Keycloak, Auth0, or Okta to authenticate users.
  • HTTPS Endpoints: For secure token and user info requests.
  • HTML and Code Nodes in n8n: To handle cookies, logic, and respond with web pages.

How This Workflow Works – Inputs, Processing, Output

Inputs

  • User browser sends request to Webhook node after OIDC login redirect.
  • Authorization code and cookies come in the request query and headers.
  • OIDC provider details and client credentials set in a variable node.

Processing Steps

  • Parse cookies using the Code node.
  • Check if authorization code is present and if PKCE authentication is off with an If node.
  • Exchange authorization code for access token using the HTTP Request node.
  • Check if access token exists with an If node.
  • Use the access token to get user profile info from the userinfo endpoint via HTTP GET.
  • Check the user info response for valid email with an If node.
  • Prepare either a personalized welcome HTML page or login form HTML depending on validation results.

Output

  • The workflow responds to the user browser with dynamic HTML: a welcome message or a login form.
  • The user sees login success or is asked to log in again.

Beginner Step-by-Step: How to Use This Workflow in n8n

Step 1: Import Workflow into n8n

  1. Download the workflow file from this page.
  2. Open your n8n editor where you want to run the workflow.
  3. Click “Import from File” in n8n and upload the downloaded workflow file.

Step 2: Update Credentials and Settings

  1. Set up OIDC client credentials: client ID, client secret, and endpoints in the Set variables node.
  2. Update redirect URI to match the URL of the Webhook node in n8n.
  3. Fill in any extra IDs, emails, or channels if your workflow has them.

Step 3: Test the Workflow

  1. Run the workflow once manually, or trigger a login flow by visiting your OIDC provider login URL.
  2. Watch the execution to make sure tokens and user info are fetched correctly.

Step 4: Activate Workflow for Production

  1. Turn on the workflow by toggling it active in n8n.
  2. Make sure your OIDC client in the provider points to the Webhook node URL as redirect URI.

Now the login flow is running live with no need to write extra code.

Consider using self-host n8n if you want your own domain and more control.


Customization Ideas

  • Switch PKCE authentication on or off by toggling the boolean in the variable node.
  • Edit the login page HTML node to change style, text, or add brand logos.
  • Add more scopes like “profile” to request extra user information during login.
  • Extend the workflow to save user info in a database or send alerts after login.

Handling Common Issues

  • Access token missing: Check client ID, secret, redirect URI, and token endpoint in variable node to fix credentials issues.
  • User email missing: Make sure userinfo endpoint is correct and scope includes “openid”.

Summary of Benefits and Outcomes

✓ Saves time by removing manual token handling steps.

✓ Provides clear login flow with dynamic user feedback.

✓ Easily adaptable for different OIDC providers.

→ Lets users log in securely through OIDC inside n8n workflows.

→ Gives developers a ready-made, working client that reduces errors.


Frequently Asked Questions

Yes, the workflow works with any standard OpenID Connect provider if the correct endpoints and credentials are set in the variables node.
Check client ID, client secret, redirect URI, and token endpoint values for errors. These must match the identity provider’s setup exactly.
Edit the HTML content inside the login form node in n8n to update text, style, or add branding elements.
Yes, you can add extra nodes after the user info node to save data to a database or send notifications.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free