locked
Avoid Windows Authentication Popup when JSOM Replied with no Permissions RRS feed

  • Question

  • Hello,

    I have been working in SharePoint Site using JSOM to get information from subsites. These subsites do not have the same permissions. 

    So in the first page, we got Windows Authentication Popup when I tried to load elements from a subsite I do not have access to. So, this code is inside a try catch and also we are using defferred with .fail() function

    deferredCallToJSOM.done(function (){

    success();

    }).fail(function () {

    error();

    });

    So, would like to know how to avoid them. How to verify if I have access to the site without the Windows Authentication Popup.

    Best regards,

    Jose Luis

    Thursday, June 13, 2019 1:54 PM

Answers

  • Hi,

    As a workaround, in SharePoint 2013, we can create a custom web service and use server code to achieve it, then consume the web service from the client web parts.

    Best regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, June 17, 2019 8:20 AM

All replies

  • Hi Jose,

    By default, if you don't have the permission to access the SharePoint contents using JSOM, you will get Windows Authentication Popup.

    As a workaround, we can create a visual web part to access the sub site data and using SPSecurity.RunWithElevatedPrivileges method to promote the permission.

    https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-server/ms439682(v%3Doffice.15)

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Friday, June 14, 2019 2:22 AM
  • Hello Dennis,

    We are using mostly Client WebParts with JSOM, so I guess is not possible for elevate the previleges.

    Is there any other solution?

    Thank you!

    Monday, June 17, 2019 8:17 AM
  • Hi,

    As a workaround, in SharePoint 2013, we can create a custom web service and use server code to achieve it, then consume the web service from the client web parts.

    Best regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, June 17, 2019 8:20 AM