Feb 21 2019 10:10 AM
I'm building a company web app with Node/Express and MongoDB. The authentication is handled by Auth0 and I have it set up so employees sign in with their Azure/Office365 credentials.
I want to be able to get, post, and put documents in our sharepoint sites from the web app. I.e. I'm building a controller for our Purchase Orders and want to be able to upload the POs to the corresponding specific POs folder in the SharePoint site.
Do I need a separate authentication/token for using the sharepoint REST api for doing something like this when users are already signed in to the web app with their Office365/Azure credentials through Auth0?
Feb 22 2019 02:53 AM - edited Feb 22 2019 02:57 AM
Hi Joseph,
Here's a pretty comprehensive list of the tools available for authenticating from a Node app to SharePoint Online.
https://github.com/SharePoint-NodeJS/Awesome-SharePoint-Node.js
What's your situation though? Do you need user permissions? For example, are you making calls to SharePoint lists where you need to return only items to which the logged in user has permissions? If that's the case, you're going to want to use the user's credentials and possibly look at Microsoft Graph with delegated permissions rather than direct connections to SharePoint.
https://docs.microsoft.com/en-us/graph/auth-overview
https://docs.microsoft.com/en-gb/graph/tutorials/node?tutorial-step=3
If you just need your app to connect to SharePoint and you don't need to security trim results or access by user (all users have the same permissions to your SharePoint list/library), your easiest option is probably to register the app in SharePoint or Azure AD grant it "App-Only" permissions for SharePoint then use the clientID and clientSecret from that. The first link has some resources for doing that from a Node app.
Feb 25 2019 08:04 AM
Feb 26 2019 04:56 AM
SolutionAs it happens, @Paolo Pialorsi just did a demo on a potentially similar situation to yours!