When I Get the document list from SharePoint site I get this error "401 (Unauthorized)" only in Google Chrome, but in IE it works. This is my code

function GetListItems() {
var siteURL = "http://localhost:8032/_api/web/GetFolderByServerRelativeUrl('Data%20Do')/File";
            return $.ajax({
                url: siteURL,
                async: false,
                method: "GET",

                headers: {
                    "Accept": "application/json;odata=verbose",

I get this two error in Google Chrome:

OPTIONS "http:......" 401 (Unauthorized)


jquery-1.7.2.min.js:4 XMLHttpRequest cannot load http://localhost:8032/_api/web/GetFolderByServerRelativeUrl('Data%20Do')/Files. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8032' is therefore not allowed access. The response had HTTP status code 401.

  • Close chrome and restart with the --disable-web-security Mode and then try if it opens up correctly Feb 24 '17 at 7:26
  • Question: Have you tried it in an incognito Chrome window? I have several sites that don't work in regular Chrome windows but work in incognito windows. Feb 24 '17 at 13:26
  • Localhost? What type of app are you developing? If this is a provider-hosted app, you need to use OAUTH, cookies or an NTLM header. If this is sharepoint-hosted, then you need the request digest.
    – wjervis
    Feb 24 '17 at 16:37

Turn on the Negotiate provider in Authentication in IIS.

After adding Negotiate, make an IIS reset . This will work .


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.