Hi, I am facing the following error when I am trying to use Platform API through Node.JS
AxiosError: unable to get local issuer certificate
at TLSSocket.onConnectSecure (node:_tls_wrap:1550:34)
at TLSSocket.emit (node:events:514:28)
at TLSSocket._finishInit (node:_tls_wrap:967:8)
at ssl.onhandshakedone (node:_tls_wrap:743:12) {
code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},..
Following is the code which is giving me an error
// Obtain a reference to the platformClient object
const platformClient = require('purecloud-platform-client-v2');
const clientId = "my-client-id"
const clientSecret = "my-client-secret"
const client = platformClient.ApiClient.instance;
client.loginClientCredentialsGrant(clientId,clientSecret).then(()=> {
// Do authenticated things
console.log("Authenticated");
})
.catch((err) => {
// Handle failure response
console.log("fail");
console.log(err);
});
The API with the same client ID & client Secret is working when I am invoking it through Postman
Am I doing anything wrong, please help