Skip to main content

I'm trying to setup a next.js app that integrates using the typescript SDK.  When I used the developer token everything works find.



import { BoxClient } from "box-typescript-sdk-gen/lib/client.generated";
import { BoxDeveloperTokenAuth } from "box-typescript-sdk-gen/lib/developerTokenAuth.generated";

const auth = new BoxDeveloperTokenAuth({
  token: process.env.BOX_DEVELOPER_TOKEN!,
});

client = new BoxClient({ auth });

async function getAllTemplates() {
  return await client.signTemplates.getSignTemplates();
}


however when I try to use the client credentials the same function for getAllTemplates return the error:



Cannot read properties of undefined (reading 'get')
    at BoxCcgAuth.eval (webpack-internal:///(action-browser)/../../node_modules/box-typescript-sdk-gen/lib/ccgAuth.js:67:51)


Here is my code doing the client credentials.



import { BoxCcgAuth } from "box-typescript-sdk-gen/lib/ccgAuth";
import { BoxClient } from "box-typescript-sdk-gen/lib/client.generated";

const ccgConfig = {
  clientId: process.env.BOX_CLIENT_ID!,
  clientSecret: process.env.BOX_CLIENT_SECRET!,
  enterpriseId: process.env.BOX_ENTERPRISE_ID!,
};

const ccgAuth = new BoxCcgAuth({ config: ccgConfig });

client = new BoxClient({ auth: ccgAuth });

async function getAllTemplates() {
  return await client.signTemplates.getSignTemplates();
}

What am I missing?

Hi Nicodemus, 


Welcome to Box Community and glad to assist! 


I have created a ticket and a member from Product Support will get in touch, please keep an eye out. 


Thanks for posting! 


Reply