CXone API 401 on client_credentials grant with valid secret

Trying to get a token from CXone using client_credentials. My endpoint is /api/auth/v1/token. I’m sending the grant type, client ID, and secret in the body as per docs. Response is 401 Unauthorized. Here is the payload:

grant_type=client_credentials&client_id=myId&client_secret=mySecret

I checked the credentials in the portal. They look correct. The app is set for server-to-server auth.

  • C# HttpClient used
  • Content-Type: application/x-www-form-urlencoded
  • No proxy issues

What am I missing?

Check your content-type header. It needs to be application/x-www-form-urlencoded, not json. Also, ensure the secret isn’t url-encoded twice.

var content = new FormUrlEncodedContent(new[]
{
 new KeyValuePair<string, string>("grant_type", "client_credentials"),
 new KeyValuePair<string, string>("client_id", clientId),
 new KeyValuePair<string, string>("client_secret", clientSecret)
});