Hi,
I'm working on a simple application using the Genesys Cloud SDK (purecloud-platform-client-v2
), and I've encountered an error that I need help troubleshooting. Despite the app functioning correctly with AWS connections etc, I'm facing an issue specific to Genesys Cloud API interactions.
Environment Details:
- Node.js Version: v20.10.0
- Genesys Cloud SDK Version: ^185.0.0
Error Encountered: While trying to authenticate using the client credentials grant, the app throws the following error:
AxiosError: Request failed with status code 400
error: 'unauthorized_client',
description: 'client is not authorized to use the client_credential grant type',
error_description: 'client is not authorized to use the client_credential grant type'
**Sample Code:**
javascriptCopy code
const platformClient = require('purecloud-platform-client-v2');
const client = platformClient.ApiClient.instance;
// Credentials redacted
const CLIENT_ID = 'xxx';
const CLIENT_SECRET = 'xxx';
client.setEnvironment(platformClient.PureCloudRegionHosts.eu_west_1);
let organizationApi = new platformClient.OrganizationApi();
console.log('Getting Ready');
client.loginClientCredentialsGrant(CLIENT_ID, CLIENT_SECRET)
.then(() => {
organizationApi.getOrganizationsMe()
.then((data) => {
console.log(`getOrganizationsMe success! data: ${JSON.stringify(data, null, 2)}`);
})
.catch((err) => {
console.error('Error calling getOrganizationsMe', err);
});
});
``
Given that this setup works well with AWS, is there any other reason besides the OAuth client configuration that might cause this error with Genesys Cloud?
Any insights or suggestions would be greatly appreciated.
---