Unable to use OAuth to access K2 API - getting 401 Unauthorized response
kbt179986
PRODUCTIssue
You are unable to use OAuth to access K2 API. You are unable to authenticate using OAuth2 when using K2 API, although everything appears to be configured correctly in K2 Management portal and AAD.
When testing with Postman, you are able to request a token for https://api.k2.com, but when making a call to https://KUID.onk2.com/api/odata/v3/ or https://KUID.onk2.com/api/Workflow/V1/workflows with the token in the header, you just receive a 401 Unauthorized response.
You are also unable to access K2 API using Swagger UI as it always gives a 401 Unauthorized error.
Symptoms
When making a call to https://KUID.onk2.com/api/odata/v3/ or https://KUID.onk2.com/api/Workflow/V1/workflows with the token in the header you receive a 401 Unauthorized response.
Resolution
This problem can appear when your OAuth URL does not have final forward slash, i.e. it looks as follows:
In this case adding "/" to the very end of this URL can resolve your problem.