I have an SP app, which I am hoping to release to the store.
The last thing I want to implement in it is a licence check, which I am doing on the server side (C#).
I found that to do this I need to first retrieve the current licences from SharePoint, which I am trying to do with this code:
ClientResult<AppLicenseCollection> licenseCollection = Utility.GetAppLicenseInformation(clientContext, productId);
clientContext.Load(clientContext.Web);
clientContext.ExecuteQuery();
However executing this code gives me an error: The remote server returned an error: (403) Forbidden.
I tried running this with various permissions granted to the app (up to full control over web/site/tenant) still with the same error.
Does anyone know what's missing?, I'm taking the product ID from the app catalog and the context seems ok, as it returns results for other types of requests.