How can I get the access token of the user logged in using widget in RingCentral?

143 views Asked by At

I'm using the RingCentral Embeddable widget using the following code.

(function() {
    var rcs = document.createElement("script");
    rcs.src = "https://ringcentral.github.io/ringcentral-embeddable/adapter.js?clientId={client_id}&appServer={app_server}&redirectUri={redirect_uri}";
    var rcs0 = document.getElementsByTagName("script")[0];
    rcs0.parentNode.insertBefore(rcs, rcs0);
  if (window.RCAdapter) {
    window.RCAdapter.setMinimized(false);
  }
})();

I want to store the token, refresh token and user id after a successful login. Can someone please help in how can I get the above details if I'm just using the ringcentral widget?

1

There are 1 answers

0
Grokify On BEST ANSWER

The access token is available in the browser's local storage with the key sdk-rc-widgetplatform. See the following:

Token is saved at Browser localStorage with key sdk-rc-widgetplatform. You can only access it when your deploy the app in your domain. But it is not recommended to use token, token will be expired and changed when the app refresh it.

If you want to manage token in server side, you can have a look at RingCentral proxy project, it make authorization in server side #349

https://github.com/ringcentral/ringcentral-embeddable/issues/510