robert-raj8062 avatar image
robert-raj8062 asked Phong Vu answered

get account details using access token uing javascript sdk

How to get account details using access token By using Javascript SDk

After login will get access token and refresh token by using this token get account detials and create subscription for this account

Thanks in advance

1 |3000

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

1 Answer

Phong Vu avatar image
Phong Vu answered
Hi Robert,

Here is the code to read a user extension info and phone number given an access token.

var rcsdk = new RC({
    server: process.env.RC_SERVER,
    appKey: process.env.RC_APP_KEY,
    appSecret: process.env.RC_APP_SECRET

var platform = rcsdk.platform();

var data = platform.auth().data();
data.token_type = "bearer"
data.expires_in = your_AccessToken_Expiration
data.access_token = your_AccessToken
data.refresh_token = your_RefreshToken
data.refresh_token_expires_in = your_RefreshToken_Expiraion

.then(function(response) {
  var jsonObj =response.json();
  // check API reference for more details
  // And if you want to get the phone number
  platform.get('/account/~/extension/' + + '/phone-number')
  .then(function(response) {
  }).catch(function(e) {
    throw e;
}).catch(function(e) {
  throw e;

// And subscribe for notification using pubnub
var subscription = rcsdk.createSubscription()
function subcribeForNotification(){
  var eventFilters = []
  // specify event types you want to get notification
  eventFilters.push('/restapi/v1.0/account/~/extension/~/event_type here')
// incoming notification
subscription.on(, function(notification){

Hope this helps.
+ Phong
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