Skip to main content

I am following steps as:

1. Create platform object and sign in to platform using oauth code obtained:

const { SDK } = require('@ringcentral/sdk');

const rcsdk = new SDK({
server: 'https://platform.devtest.ringcentral.com/',
clientId: '',
clientSecret: ''});

const platform = rcsdk.platform();
platform.login({code, redirect_uri});

We store the refresh token obtained from login. Platform is destroyed.

2. Use refresh token obtained above to log in to platform and use Ringcentral APIs. For example, I am trying to access extension information here:

const { SDK } = require('@ringcentral/sdk');

const rcsdk = new SDK({
server: 'https://platform.devtest.ringcentral.com/',
clientId: '',
clientSecret: ''});

const platform = rcsdk.platform();
platform.auth().setData({ refresh_token});
const resposne = platform.get('/restapi/v1.0/account/~/extension');
// response is empty

const newAuthData = platform.auth().data();
// save newAuthData so that when platform is destroyed we can use refresh token
// I have made sure that tokens are managed properly (checking they are expired and if needed refreshing as well)

The problem here is that fetching resources by SDK are returning empty response, i.e though its 200 OK, I am not getting anything in response. I tried fetching call logs etc. and the issue is same for all cases.

One thing to note here is that using APIs via postman with access tokens obtained through SDK work fine and I am able to get a proper response.






What is inside the "refresh_tokens" passed to this function within a { }? Where do you get it? Is it a string or a JSOn object? I am sure that that is the invalid one.

  1. platform.auth().setData({ refresh_token});

it's an object:

platform.auth().setData({ refresh_token: 'token'});


Reply