0

I am using CSOM to connect to SharePoint on-premises site. I want to authenticate SharePoint site by using Azure AD, but it returns 401 error.

Please help me. Thanks.

7
  • Is your SharePoint on-premises farm linked to a local AD or Azure AD? Oct 11, 2022 at 8:59
  • Hello @CallumCrowley, thanks for your comment, My Farm linked to local AD, my code follow this acticle learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/…, but when i get token from Azure and set Authorizetion to my site like: var context = new ClientContext(web); context.ExecutingWebRequest += (sender, e) => { e.WebRequestExecutor.RequestHeaders["Authorization"] = "Bearer " + accessToken; }; But context not authorize.
    – Thai Hồ
    Oct 11, 2022 at 9:32
  • If your on-premises is linked to local AD, then you can't use Azure AD to authenticate with your SharePoint farm. Oct 11, 2022 at 9:41
  • I config my site by follow this acticle learn.microsoft.com/en-us/azure/active-directory/saas-apps/…, it work, but i authentication by CSOM it not work
    – Thai Hồ
    Oct 11, 2022 at 9:55
  • Ahhh I see, I'm not sure how you go about authenticating in that scenario Oct 11, 2022 at 10:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.