Pages

Friday, September 9, 2016

"Your domain doesn't match the expected domain for this app deployment." issue in provider hosted add-in

Problem

One of my friend had an issue after deploying his provider hosted add-in in SharePoint on premise environment. He was not able to access list data from the add-in web of the Add-in. I looked at the code and the error was something as below.

provider

Solution

Step 01

Get the add-in id by navigating to

http://<SharePointWebsite>/_layouts/15/AppPrincipals.aspx

App identifier was something like the below and the text which was bolded will be the add-in id.

i:0i.t|ms.sp.ext|21ed123y-b1u9-4d54-9cb1-ee36b5f91304@9d2c9af1-aa54-42rf-ab8d-37d639b3f6ed

Step 02

Get the App Domain by going to below url and giving the add-in id which we got from the above.

http://<SharePointWebsite>/_layouts/15/AppInv.aspx

Step 03

My observation was that the App Domain which was given during registering the add-in was different from the url where the add-in has been hosted.

So, I registered the add-in again in the SharePoint site with the correct IIS host header and redeployed the add-in; which lead to work perfectly.

References

https://msdn.microsoft.com/en-us/library/office/jj687469.aspx