Issue

Error when searching for Azure Active Directory users:
"Exception has been thrown by the target of an invocation. OAuth token requires authorization. "

Symptoms

Executing the UMUser Get Users method where Label='AAD' returns the error.

Troubleshooting Steps

The steps below were based on an environment using Azure Active Directory but is not integrated with SharePoint Online.

  1. Open the K2 Management Site.
  2. Expand the Integration node.
  3. Go to Service Instances.
  4. Select the Azure Active Directory service instance.
  5. You may choose to either click on Edit or Refresh Service Instance.
  6. If you chose Edit, click on OK to update the instance.
  7. You should see an OAuth Error with message Redirecting for Authorization. Retry after successful authorization.
    Image
  8. If you are prompted to login, provide the credentials of the AAD Tenant Admin.
  9. This should redirect to a page showing Authorization Successful.
    Image

If SharePoint Online is in use, try running the Registration Wizard.