2

I am writing a JavaScript Node.js app to access a SharePoint 2013 server. I want to use REST calls to SharePoint. I believe I want to use OAuth authentication, as this "App" (as MS calls it), is living outside of the server where SharePoint is installed.

There are several guides that describe how to setup the OAuth with SharePoint, as follows:

http://spshell.blogspot.com/2015/03/sharepoint-online-o365-oauth.html

http://jomit.blogspot.com/2013/03/authentication-and-authorization-with.html

http://www.ktskumar.com/2017/01/access-sharepoint-online-using-postman/

http://www.vibhutisinha.com/2014/09/step-by-step-to-create-authorization.html

https://medium.com/@yash_agarwal2/performing-oauth-and-rest-calls-with-sharepoint-online-without-creating-an-add-in-677e15c8d6ab

Overall, the procedures are the same. Some of these refer to SharePoint Online, others don't say which version.

Here is what I am doing:

  1. I am able to register my App at the AppRegNew.aspx page.
  2. I Grab the realm of our site from the AppPrincipals.aspx page of our site (the part after the @).
  3. When I go to the OauthAuthorize.aspx page, It will ask "Do You trust ". I click on the "Trust It" button, and then I am sent to the redirect page I specify, however I get get the parameters, "error" = server_error and "error description" = "The Azure Access Control Service is unavailable".

I expect to get a value called "code", which I then call with accounts.accesscontrol.windows.net. Yet, even that seems wrong, as this is NOT SharePoint Online, so I would not expect our installation to us ACS.

What do I need to do to get an access token, which I could pass into my REST call with the header "Authorization: Bearer ".

Maybe I am going about this the wrong way, if so, could you kindly point me in the correct direction?

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.