Describe the problem/error/question
I’m trying to set up OIDC SSO on my self-hosted n8n instance (v2.15) using Microsoft Entra ID (Azure AD) and I can’t get it to work. I’ve followed the official N8N OIDC documentation but I keep hitting errors depending on the configuration.
What I’ve configured in Azure (App Registration):
- Redirect URI:
https://n8n.mycompany.com/rest/sso/oidc/callback - Exposed an API with Application ID URI:
api://n8n.mycompany.com - Created a custom scope
n8n→api://n8n.mycompany.com/n8n - Authorized the app’s own Client ID as an authorized client application for that scope
- API permissions:
openid,email,profile,User.Read, n8n (api://n8n.mycompany.com/n8n) - Discovery endpoint:
https://login.microsoftonline.com/{tenant-id}/v2.0/.well-known/openid-configuration
What I’ve configured in n8n:
- Settings → SSO → OIDC
- Filled in: Discovery Endpoint, Client ID, Client Secret
- User role provisioning: Instance Role
What I’ve already checked:
- Redirect URI in Azure matches exactly (no trailing slash, correct casing)
- Discovery Endpoint resolves correctly
- Client ID and Client Secret are correctly copied
- Server time is in sync
What is the error message?
Error — When “User role provisioning” is set to anything other than “Managed in n8n”:
AADSTS650053: The application 'n8n.mycompany.com SSO' asked for scope 'n8n'
that doesn't exist on the resource '00000003-0000-0000-c000-000000000000'.
Contact the app vendor.
n8n seems to hardcode a bare n8n scope in the OIDC request. Azure interprets this as a Microsoft Graph scope, which doesn’t exist. There is no UI field or documented environment variable to override it with the full api://n8n.mycompany.com/n8n format that Azure requires.
My questions:
- Is there an environment variable to control which scopes n8n requests? (e.g.
N8N_SSO_OIDC_SCOPE) - Has anyone successfully set up OIDC with Microsoft Entra ID on a recent n8n version? What did your Azure config look like?
- I’ve missed something?
Information on your n8n setup
- n8n version: 2.15
- Database (default: SQLite): PostgreSQL
- n8n EXECUTIONS_PROCESS setting (default: own, main): main
- Running n8n via (Docker, npm, n8n cloud, desktop app): kubeadm
- Operating system: Ubuntu
Any help would be greatly appreciated. Thanks!