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

  • 1
  • Question
  • Updated 11 months ago
  • (Edited)
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?
Photo of hamb 1

hamb 1

  • 120 Points 100 badge 2x thumb
  • anxious

Posted 11 months ago

  • 1
Photo of Phong Vu

Phong Vu, Devangelist

  • 2,466 Points 2k badge 2x thumb
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
Photo of hamb 1

hamb 1

  • 120 Points 100 badge 2x thumb
This is not working for me,
Can you please tell in API Explorer ?
(Edited)
Photo of Phong Vu

Phong Vu, Devangelist

  • 2,466 Points 2k badge 2x thumb
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?