I created a Node.js App that connects to SharePoint(OnPremise and O365) and does all sorts of things.
The app uses sp-request and node-sp-auth APIs for Basic Authentication (username, password),
and service calls
But I want to migrate to OAuth for security purposes.
I tried using node-sp-auth to connect using OAuth, but it only supports connection without user context, using (clientId,clientSecret), generated when registering the app on SharePoint.
The problem is this app is a mobile app destined for hundreds of users inside a company and every user has a different SharePoint account and permissions.
I also tried using passport-sharepoint but couldn't make work because the documentation is horrible (two bits of code full of mistakes and not functional).
Can anyone point me to the right direction ?
passport-sharepoint
is the only option I'm aware of. And that's true, samples look strange, and in general it looks like the project is not supported. Also it implements only low-trust scenario and doesn't work for high-trust. I have plans to implement proper authentication middleware for node and SharePoint, but this plans for next year.. – Sergei Sergeev Dec 8 '16 at 11:15sp-request
supports all auth options fromnode-sp-auth
, you can use oauth "clientId clientSecret" flow forsp-request
too, but without user context (in SharePoint it called addin-only permissions, in oauth it's client credentials flow) – Sergei Sergeev Dec 8 '16 at 11:18