Skip to main content
Question

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

  • September 6, 2017
  • 3 replies
  • 1340 views

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?

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • September 6, 2017
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

  • New Participant
  • September 16, 2017
This is not working for me,
Can you please tell in API Explorer ?

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • September 16, 2017
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?

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings