platformClient.ApiClient.instance is undefiend

Hi,

I'm trying to build a react application. I installed and import purecloud-platform-client-v2 package (I tried with either version 138.0.0 or 138.0.1)

However, I got the an error on:

const client = platformClient.ApiClient.instance;

The error says:
Uncaught TypeError: Cannot read properties of undefined (reading 'instance')
at App (App.js:10:1)

Here's the code snippet:

 const platformClient = require('purecloud-platform-client-v2');
 var clientId = process.env.GENESYS_CLOUD_CLIENT_ID;
 var redirectUri = "http://localhost:8080/oauth/callback";
 const client = platformClient.ApiClient.instance;
 client.setEnvironment(platformClient.PureCloudRegionHosts.ca_central_1);
 client.loginImplicitGrant(clientId, redirectUri)
 .then((data) => {
     console.log(data);
  })

*** I tried with either
const platformClient = require('purecloud-platform-client-v2');
Or
import platformClient = from 'purecloud-platform-client-v2';

Hello,

You can find an example project for a React app with Typescript in this blueprint.
Develop a React app with Typescript that uses the Genesys Cloud Platform SDK.

Regards,

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