question

Krishna Jha avatar image
Krishna Jha asked Krishna Jha commented

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

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?

rest api
3 comments
1 |1500 characters needed characters left characters exceeded

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

Not sure about your purpose of storing the tokens, but you should know that the embeddable widget keeps refreshing the tokens itself and once that happens, the tokens you store will become invalid. Or if you use the refresh token to refresh the access token, the widget will not be able to refresh the tokens anymore. Anyway, @Embbnux Ji can help you if there is a way to access the tokens or not.

0 Likes 0 ·

@Phong Vu
Thank you for your prompt response. Is there any way that we can always have the latest token that is being stored? Like any message event that gives us the token, refresh token and user id?

0 Likes 0 ·

@Phong Vu What I'm basically looking for is I want to call the call logs API which will use the bearer token. If storing the token is not the efficient way then can you please suggest a way I can call the call log API without storing the token?

0 Likes 0 ·

0 Answers

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