Symptoms
The error below surfaces when we try to appify a list. If we run the registration wizard we receive a similar error.
Thread 1: The remote server returned an error: (401) Unauthorized.Failed to initialize the Context: URL: https:///URL]/sites/ssitename] Username: Error Details: Method: SharePointService.initializeContext x-ms-diagnostics : 3000003reason="Invalid audience Uri xxx/xxxx/xxxx/xxxx."category="invalid_client" SPRequestGuid : xxxxxx
Diagnoses
This error usually surfaces when a certificate has been updated or has expired. K2 was using the previous certificate to create Trust between SharePoint and K2 and now it has expired the audience URI becomes invalid.
If the SharePoint Authentication Realm changes, existing sites that use the K2 for SharePoint 2013 integration will break.
Resolution
1. Remove the app from the site collection
2. Run the K2 AppDeployment.exe tool to fix the SPTrustedSecurityIssuer
3. Add the app to the site collection
4. Run the Registration Wizard
The AppDeployment.exe refreshes K2 to use the new SPTrustedSecurityIssuer.