Somnath Swami avatar image
Somnath Swami asked Somnath Swami edited

SDK issue failed to fetch client.account().get() on login success

I am trying to log in using ring central SDK in the js app after login success I am getting a fetch error.

. then (() => { console . log ( 'Login success' , client . account ()) ;
return client . account () . get ();

versions we using

"@ringcentral/sdk" : "^4.7.0" , "ringcentral-client" : "^1.0.0-beta.2"

main.js:69 Error occured TypeError: Failed to fetch

at Client.<anonymous> (Client.ts:93:38)

at step (index.js:17:1)

at (index.js:17:1)

at index.js:17:1

at new Promise (<anonymous>)

at __awaiter (index.js:17:1)

at Client._loadResponse (Client.ts:92:48)

at Client.<anonymous> (Client.ts:76:35)

at step (index.js:17:1)

at (index.js:17:1)

1 |3000

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

Yatin Gera avatar image Yatin Gera ♦♦ commented ·

Hi @Somnath Swami
Can you please attach more code for context?
We'd want to see the code to be able to help you here.


-1 Like -1 ·
Somnath Swami avatar image Somnath Swami Yatin Gera ♦♦ commented ·
const ringcentral = require('ringcentral-client');
const RingCentralClient = ringcentral.Client;const { SERVER_PRODUCTION } = ringcentral;const { SDK } = require('@ringcentral/sdk');
console.log('client details', myClient);
const sdk = new SDK({
                        server: SERVER_PRODUCTION, // Optional, default is production server  clientId: 'XXXX',  clientSecret: 'XXXX',  redirectUri: 'http://localhost:8080/',});const client = new RingCentralClient(sdk);

                        username: '+XXX',  extension: 'XXX',  password: 'XXXXX',}).then(() => {
                        console.log('Login success', client.account());
  return client.account().get(); // Call RingCentral REST API}).then((accountInfo) => {
                        console.log('Current account info', accountInfo);  return sdk.platform().logout(); // Logout})  .then(() => {
                          console.log('logout success');  })  .catch((e) => {
                          console.error('Error occured', e);  });
0 Likes 0 ·
Somnath Swami avatar image Somnath Swami Somnath Swami commented ·

in this code, we are able to see login success in the console

1 Like 1 ·

0 Answers

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