SharePoint authentication

Describe the problem/error/question

I am trying to develop an automation workflow for team to automate scraping information from a machining quote (which can be put into our team’s SharePoint) then send the acquired JSON information into our inventory Excel sheet to manage. Therefore, my first step is to try to get a download of the file to test out. I was using cloud on a trial account, successfully authenticated, but when I tried to use “download a file” SharePoint node, it says that my permission is not denied.

What is the error message (if any)?

Please share your workflow

It is just a simple first step of having a schedule trigger and download a file

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: I think that I was using the latest version on Cloud. Should I test run with npm? Because I didn’t think that would work, but please provide me with a guide on setting up my credentials for SharePoint if that works
  • Database (default: SQLite): None using rn
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):**n8n cloud
  • Operating system: Windows/ Firefox

This is usually related to some permission/grant you’re missing on the Sharepoint resource. The first thing I usually try is to broaden the permissions on the credentials/account until the action (download) works, and then narrow back to only what’s required.

If you can’t figure out the underlying cause of the 403 error that way, you might need to resort to setting up n8n locally (Docker / Docker-Compose) to watch the logs, and/or run the requests through a proxy so you can capture the requests n8n sends to Microsoft, and examine the full response, response headers, etc.

I see, I will have to take a look on the permissions that the admin can grant for authentication using cloud. Do you know if we can use npm to run a tunnel for an n8n instance server? I tried it for the OAuth2 option for authentication, but it was very buggy and did not even get any error message. Or using Docker is preferred?

All,
I was having the exact same issue, and I think I found the solution for us cloud users. I had already given admin consent and done a few other things but was still encountering the dreaded 403 error. My solution? Reconnect the sharepoint connector with an admin account as opposed to my personal account. Once I did this, I was able to get a list of my sharepoint sites (though, only the ones where my admin account is an owner of the site). Let me know if you guys have any questions, and if it works for you. Hope this helps!

I see, will have to try it that way. Just something with Microsoft with the permission granting issue that just bugs me considerably. I tried to work out some simple automation tasks with Microsoft Graph but it did not favor me well, lol. :face_with_bags_under_eyes:

Yeah, I was in the same boat. Looking at the permissions in the enterprise app on the M365 entra side and realizing n8n wasnt requesting the correct permissions. Another step I took that could have helped with this is in my ‘Microsoft Entra ID (Azure Active Directory) account’ credential in n8n, I selected the custom scopes option, and added the Sites.ReadWrite.All and Sites.Read.All permissions. This requested the permissions, but did not go through the admin consent portion, so I’m not sure if it helped. If it did then you may have to add the custom scopes, and use an admin account for the sharepoint connector for it to work. Anyway, let me know how it goes, i am curious to see if I just got lucky or this is a viable fix for everyone.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.