question

hamb-16489 avatar image
hamb-16489 asked Phong Vu answered

I have done authorization using OAuth but I don't know what number I used to auth?

I have done authorization using OAuth but I don't know what number I used to auth? Is it possible to know the exact number the user have used to authorize?

oauth
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
Short answer: Yes, you can if you have the valid accessToken. You can call the Extension Info endpoint using the accessToken.

It would be much easier to use one of our official SDKs to do this. Here is some code snippet using the Node JS SDK.

var rcsdk = new RC({
    server: https://platform.devtest.ringcentral.com,
    appKey: your_app_key,
    appSecret: your_app_secret
});
var platform = rcsdk.platform();
var data = platform.auth().data();
        data.token_type = "bearer"
        data.expires_in = 86400
        data.refresh_token_expires_in = 86400
        data.access_token = "THE accessToken"
        platform.auth().setData(data)
        platform.get('/account/~/extension/~/')
          .then(function(response) {
              var jsonObj =response.json();
              var extensionNumber = jsonObj.extensionNumber
              var userName = jsonObj.name
          })
          .catch(function(e) {
              console.log("Failed")
              console.error(e);
              throw e;
          });

Hope this helps!
Phong Vu
1 |3000

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

hamb-16489 avatar image
hamb-16489 answered
This is not working for me,
Can you please tell in API Explorer ?
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
Here is the screenshot of the API Explorer.

You just click the Try It button without providing the extension Id.

If it does not work with you code, what error did you get? Can you post the response from the server?
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