SharePoint REST API 401 Unauthorized

Michel AL HAYEK 187 Reputation points
2021-03-21T15:16:05.023+00:00

Hello everyone, I am trying to access SharePoint 2016 site from an external application (on a completely different domain) using an ajax REST API call, but I am still getting error 401 unauthorized. Is it feasible to access SharePoint from any application using client-side code? I checked some articles saying that SharePoint 2016 does not support JSONP/CORS and doing an ajax call to the SharePoint server would be enabling XSS attack.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,104 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,773 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,593 questions
0 comments No comments
{count} votes

Accepted answer
  1. Amos Wu-MSFT 4,051 Reputation points
    2021-03-22T06:49:04.333+00:00

    Try to use the IIS rewrite module.
    Similar issues for your references:
    How to allow authenticated cross-domain calls in an SP 2016 on-prem scenario?
    CORS Change in SharePoint Server 2016

    Other reference:
    Fixing issue in making cross domain Ajax call to SharePoint REST service in Chrome


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful