Error "client not found" while generating client credential token

Hi Team,

We are new to Genesys world. When we try to generate a client credential token with 'purecloud-platform-client-v2' , the below error is throwing. We double checked the client id and client secret but it is correct. So, please help us to identify what we missed here

data: {
      error: 'invalid_client',
      description: 'client not found',
      error_description: 'client not found'
    }

The javascript code we are using is

const platformClient = require('purecloud-platform-client-v2');
const client = platformClient.ApiClient.instance;
// Create API instance
var authorizationApi = new platformClient.AuthorizationApi();
client.loginClientCredentialsGrant("client_id","client_secret")
.then(() => {
    // Make request to GET /api/v2/authorization/permissions
    return authorizationApi.getAuthorizationPermissions();
  })
  .then((permissions) => {
    // Handle successful result
    console.log(permissions);
  })
  .catch((err) => {
    // Handle failure response
    console.log(err);
  });

Hi,

You will need to specify the region of the org that the credentials are for. For example to set your region to us-east-1 you would write:

client.setEnvironment(platformClient.PureCloudRegionHosts.us_east_1); 

Regards,
Declan

Thanks for the details.

How to identify this region from a Genesys account available in https://apps.usw2.pure.cloud/

That is us-west-2

Thanks, it worked.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.