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
Automate OIDC client auth with n8n and HTTP Request

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

Learn how to Build this Workflow with AI:

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.


Automate OIDC client auth with n8n and HTTP Request

Visit through Desktop to Interact with the Workflow.

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 Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.