Unable to connect Microsoft Sharepoint to n8n

Describe the problem/error/question:

We are consistently getting errors whereby we are unable to authenticate for SharePoint within our n8n tenancy. We have fully removed the n8n enterprise app from the tenancy and have tested on separate n8n instances and are still experiencing the issue.

What is the error message (if any)?

The app is removed from the tenancy , yet we still receive the above - any assistance will be greatly appreciated.

Information on your n8n setup

  • n8n version: 1.99.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system: Windows 11
2 Likes

First @twoodbridge001 ensure your Azure AD app registration is properly configured

Do check your n8n SharePoint Node Configuration

Then test Authentication Flow

Do a Network and Permission Check

And Debug

1 Like

Short version: this isn’t an n8n bug. Azure AD is rejecting the OAuth request before n8n ever gets a valid code, so n8n shows its generic “Insufficient parameters for OAuth2 callback.” The real error is in the blob you pasted:

AADSTS650057: Invalid resource: The client has requested access to a resource which is not listed in the requested permissions in the client's application registration.

What that means

  • Your OAuth flow is hitting the v1 Microsoft endpoint and is sending a resource= for SharePoint Online (00000003-0000-0ff1-ce00-000000000000).

  • But the app registration (client ID) you’re using either:

    1. no longer exists (you said the app was removed), or

    2. exists but does not have SharePoint permissions configured/consented.

  • Because Azure returns an error instead of code/state, n8n can’t finish the handshake and shows the callback message.

How to fix (pick the path that matches what you’re integrating with):

If you’re calling SharePoint/Graph with a new app

  1. Create a fresh App Registration in Entra ID (Azure AD).

  2. Add the redirect URI exactly as used by n8n Cloud:
    https://app.n8n.cloud/rest/oauth2-credential/callback

  3. Use the v2.0 endpoints in your n8n credential:

    • Auth URL: https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize

    • Token URL: https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token

  4. Do not use resource= with v2. Use scopes instead:

    • For Microsoft Graph (e.g., SharePoint via Graph): offline_access Files.ReadWrite.All Sites.ReadWrite.All (choose the minimum you need).

    • Or for SharePoint REST directly, either switch to Graph scopes or use the v1 flow and add SharePoint delegated app permissions (e.g., AllSites.FullControl) to the app.

  5. Grant admin consent for the scopes/permissions you chose.

  6. In n8n, delete the old credential (the one pointing at the removed app) and create a new OAuth2 credential with the client ID/secret from the new app and the settings above. Then re-authorize.

If you must stay on the v1 endpoint (using resource= for SharePoint)

  • Keep using https://login.microsoftonline.com/<tenant-id>/oauth2/authorize and …/token

  • Ensure the same app registration has SharePoint Online delegated permissions (e.g., AllSites.Read / AllSites.FullControl as needed) and that admin consent is granted.

  • Make sure the resource you pass matches the target service (for SPO: 00000003-0000-0ff1-ce00-000000000000 or https://{tenant}.sharepoint.com), and that the app has permissions to that resource.

Common gotchas to double-check

  • Redirect URI in the app exactly matches n8n Cloud’s callback URL.

  • Using the right tenant in the URL (avoid /common if consent is tenant-specific).

  • No stale client ID/secret left in n8n after the old app was deleted.

  • No leftover resource= query param in n8n when you switch to v2 (scopes-only).

Once Azure returns a valid code to the callback, the n8n message disappears and the credential will connect normally. Hope that helps..!!

2 Likes

Hi EzAzOz, thank you for your detailed reply, I am attempting to get this sorted.
Will let you know

Hi , okay have attempted re-creation with my colleauge and we are running into the same error again whereby it is referencing the deleted app - aad843ca-42a7-4219-a3f9-91bcf621d795

What appears to be occuring is the n8n is still trying to reference it - is there anyway to get this refreshed or deleted on the n8n side? We are using the cloud version of n8n.

Thanks

This worked. Thank you.

You’re seeing the old Client ID because some n8n credential (or node) is still using it. Azure is just echoing what n8n sends in the authorize URL. On n8n Cloud there isn’t a hidden cache you need support to purge—once you delete or reset the credential that contains the old Client ID and point your nodes to the new one, the old ID will stop appearing.

Here’s the quickest way to flush it end-to-end:

  1. Find and remove every reference to the old credential
  1. In n8n: Credentials → search the name of the Microsoft/SharePoint/Graph OAuth2 credential you used originally.

  2. Click it → Show usages (n8n lists every workflow/node using it).

  3. For each workflow:

    • Open the node that uses it → Credentials tab → select a brand-new credential (create it first; see step 2).

    • Save the node and the workflow.

  4. When no workflows use the old one, Delete the old credential.

    • If deletion is blocked, that means there’s still at least one node/version using it (often an active published version). Deactivate the workflow, switch the credential in the version you have live, save, and try deletion again.

Tip: If your colleague duplicated workflows or has them in another Project, repeat the same in that project. Credentials are project-scoped.

  1. Create a clean OAuth2 credential (v2.0 recommended)

Create a new credential with a unique name (e.g., “MS Graph OAuth2 v2 – 2025-09-01”) and set:

  • Auth URL:
    https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize

  • Token URL:
    https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token

  • Client ID / Secret: from your new App Registration

  • Redirect URI (must match App Registration):
    https://app.n8n.cloud/rest/oauth2-credential/callback

  • Scopes (no resource= on v2): pick only what you need, e.g.
    offline_access Files.ReadWrite.All Sites.ReadWrite.All (Graph)

  • Click Connect / Reauthorize so Azure returns a code → tokens.

Do not put client_id= or resource= into the Auth URL query string. If you previously customized the Auth URL and left those in, Azure will keep seeing the old ID even if you changed the fields.

  1. Repoint nodes and (re)publish
  • Open each affected node → pick the new credential by name → Save.

  • If you run published workflows, republish (or deactivate/activate) so the live version uses the new credential.

  • Now delete the old credential (it should succeed).

  1. Common reasons the old Client ID keeps showing up
  • A different workflow version (the active/published one) still references the old credential.

  • A different project has a copy of the credential still in use.

  • The Auth URL was customized and still contains a hard-coded client_id= aad843ca-….

  • The credential was “Edited” but the node is still pointing at an older credential object (create a fresh one and reselect).

  • Browser caching rarely causes this, but try the OAuth step in an Incognito window to rule it out.

  1. If you must use v1 (resource-based)

If you’re intentionally on the v1 endpoints, ensure:

  • Auth URL: /oauth2/authorize, Token URL: /oauth2/token

  • resource is correct for the API you call (e.g., SharePoint) and

  • The new App Registration has matching delegated permissions with admin consent granted.


If you walk through the “Show usages → swap credential → delete old” cycle and still see the old ID in Azure’s error, send me:

  • A screenshot of the Auth URL field from the credential,

  • The selected credential name in the node,

  • Whether the workflow is active/published,
    and I’ll pinpoint what’s still holding the old Client ID.

Hi team, thats all working for me now - thanks for the assistaince!

This helped me:

  1. First you go to your n8n dashboard/project and you add a credential.

  2. For “Select an app or service to connect to” select “Microsoft OAuth2 API”

  3. Name the credential something like “Sharepoint Permissions”

  4. For scopes, copy in Sites.Read.All Sites.ReadWrite.All SearchConfiguration.Read.All SearchConfiguration.ReadWrite.All

  5. Click the “Connect Account` button.

  6. Ensure you are using a MS tenant admin account. This won’t work if you don’t have the right permissions.

  7. n8n will request the correct scopes that were missing before.

  8. Once the connection is successful you can open up a workflow, add a Sharepoint node and create new credentials. This time, because the scopes were added already, you won’t run into the error 403 problem.

The issue is that the official Sharepoint Node does not automatically add the right scopes (or give you the option to do so) when you create a credential through there. This method circumvents that and adds the scopes that are needed so you can use the official Sharepoint n8n node.