I have used OAuth 2.0 flow to get access token and refresh token. I would be taking care of managing refresh token by saving it into some persistent storage.
I am calling an endpoint to get all the extensions for account.
const { SDK } = require('@ringcentral/sdk'); const rcsdk = new SDK({ server: 'https://platform.devtest.ringcentral.com/', clientId: '', clientSecret: '', const platform = rcsdk.platform(); const data = await platform.auth().data(); data.token_type = 'bearer'; data.expire_time = 3600; data.access_token = <access_token>; data.refresh_token = <refresh_token>; data.refresh_token_expires_time = 60480 platform.auth().setData(data); const accounts = await platform.get('/restapi/v1.0/account/accountId/extension');
I get the following error:
Error: Refresh token has expired
If same access token is used in Postman for following endpoint works:
curl --location --request GET 'https://platform.devtest.ringcentral.com/restapi/v1.0/account/accountId/extension' \ --header 'accept: application/json' \ --header 'authorization: Bearer <access_token>' \ --header 'Content-Type: application/json'
Also, how can I get the refreshed refresh_token if I use platform.refresh() ?