403 Forbidden Error in SP Client Object Model Skip to main content
https://support.okta.com/help/answers?id=9060z00000078gbqay&refurl=http%3a%2f%2fsupport.okta.com%2fhelp%2fanswers
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
1
2
3
4
5
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Arvind MaheshwariArvind Maheshwari 

403 Forbidden Error in SP Client Object Model

SharePoint client object model code which was working earlier now throws 403 forbidden error after OKTA integration. Given below is sample code:
 
var xmlDocument = new XmlDocument();
                XDocument xdoc = new XDocument();
                string siteURL = "http://<site-collection-url> (http://%3csite-collection-url%3e)";
                using (ClientContext context = new ClientContext(siteURL))
                {
 
                    Uri siteURI = new Uri(siteURL);
                    Uri xmlDocURI = new Uri(" http://<site-collection-url>/XMLDocLibraryName/MegaMenu.xml (%20http:/%3csite-collection-url%3e/XMLDocLibraryName/MegaMenu.xml)");
                    string xDocURL = xmlDocURI.AbsoluteUri;
                   context.Credentials = new NetworkCredential(farm-account, farm-acc-pwd);                
                      context.ExecuteQuery();
                
                 ………………………….
                      }
 
It fails on ExecuteQuery and throws 403 forbidden error.

I guess OKTA will provide some kind of token to authorize these request. Do we have any API from OKTA which generates token?
 
Marius VoinescuMarius Voinescu (Okta, Inc.)
This looks like a configruation error and I would suggest doulbe checking the deployment guide for the Sharepoint, and if further assistance is needed to open a ticket with Okta.

https://support.okta.com/help/Documentation/Knowledge_Article/Microsoft-SharePoint-On-Premises-Deployment-Guide