I followed this tutorial to deploy Provider Hosted App to production environment. It has a proper SSL certificate installed, it's registered within SharePoint and TokenHelper class is modified. App permissions are set to Full Control for web and site collection.

When I use TokenHelper.CreateAppEventClientContext(properties, false) or TokenHelper.CreateRemoteEventReceiverClientContext(properties) methods to get ClientContext, it's returned null and the code throws 401 Unauthorized exception.

I get a proper ClientContext when I create it manually and provide the credentials of farm admin account, but it's not an acceptable solution for production. Also, from the two methods, what is the correct way to get ClientContext in this case?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.