Legacy Dev Forum Posts

 View Only

Sign Up

platformClient.ApiClient.instance is undefiend

  • 1.  platformClient.ApiClient.instance is undefiend

    Posted 06-05-2025 18:03

    pouyan | 2022-06-10 15:42:22 UTC | #1

    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.GENESYSCLOUDCLIENTID; var redirectUri = "http://localhost:8080/oauth/callback"; const client = platformClient.ApiClient.instance; client.setEnvironment(platformClient.PureCloudRegionHosts.cacentral_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';


    Jerome.Saint-Marc | 2022-06-12 07:17:32 UTC | #2

    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,


    system | 2022-07-13 07:18:20 UTC | #3

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


    This post was migrated from the old Developer Forum.

    ref: 15088