question

Nick Argyle avatar image
Nick Argyle asked Nick Argyle answered

JWT: error Error: Client authentication is required | Node SDK

Using this code to try and authenticate the SDK.

import { SDK } from "@ringcentral/sdk";

export default async function fetchRingCentralData() {
  const rcsdk = new SDK({
    server: process.env.RC_SERVER,
    appKey: process.env.RC_CLIENTID,
    appSecret: process.env.RC_CLIENTSECRET,
  });
  const platform = rcsdk.platform();
 
  await platform.login({ jwt: process.env.RC_JWT });
}


Receiving error

Error: Client authentication is required 


The app is set up as a JWT app.

cleanshot-2023-10-20-at-131844.png


Can someone help?

sdkauthentication
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered

The new SDK constructor takes new param object.

const rcsdk = new SDK({
    server: process.env.RC_SERVER,
    clientId: process.env.RC_CLIENTID,
    clientSecret: process.env.RC_CLIENTSECRET,
  });

Can you share the link to the documentation or sample code that shows you the old code. We will fix the documentation accordingly. Thanks.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Nick Argyle avatar image
Nick Argyle answered

That worked, thank you. I probably pulled that from some other community post's code when debugging something else. Could've sworn I tested what was in the docs, but apparently not. Docs all appear correct.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Nick Argyle avatar image
Nick Argyle answered

Oh wait, it's in the test data here - https://developers.ringcentral.com/api-reference/provisioningcleanshot-2023-10-20-at-173932.png


1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys