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 ?

  • 1
    Unfortunately, by now 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:15
  • 1
    BTW, sp-request supports all auth options from node-sp-auth, you can use oauth "clientId clientSecret" flow for sp-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
  • 1
    Ok thanks @Kai I guess I'll just stick with Basic Authentication for now, but if you do implement it, please post a response on this question. I'm sure there will be people interested in that. – Ali Dec 8 '16 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.