question

Nathan Douds avatar image
Nathan Douds asked Embbnux Ji commented

Embeddable Implementation + Make API Call

I'm hoping to use the Embeddable widget for 95% of our new app's functionality, however there are a few things that I need which appear to only come from making REST calls.

What is the simplest way for me to use the embeddable widget (and the out of the box auth functionality) and then make an API request on behalf of the currently logged in user. Please note: for this app, it will be public, so users outside of the app's client id will be the ones logging in primarily. Everything I've tried so far keeps giving me a 401.

rest apigetting startedembeddable
1 |3000

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

1 Answer

Embbnux Ji avatar image
Embbnux Ji answered Embbnux Ji commented

Hi @Nathan Douds Can you share which API you want to request out of the embeddable. For some commands, you can use embeddable's API directly https://github.com/ringcentral/ringcentral-embeddable/blob/master/docs/control-widget.md#control-widget

Any API request to RingCentral server require access token. Currently the embeddable saves access token in the iframe's local storage. You can only access that when you host the embeddable in the same domain. But it is not recommended to use token inside the embeddable, as the widget will refresh the token and expired old one.

If you want to request RingCentral API, It is better that you create another RingCentral RESTful app, and have another token management in the server side.

2 comments
1 |3000

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

Nathan Douds avatar image Nathan Douds commented ·

As an example, I need to be able to access all company call recordings for display in our app. It would be great if there was a way to just hook into the widget for this, but I'm assuming my backend needs to make a call, in which case it sounds like we'll need some other separate auth flow for this.

0 Likes 0 ·
Embbnux Ji avatar image Embbnux Ji Nathan Douds commented ·

Thanks for the example. For this example, it is required to using creating another RingCentral RESTful app with another authorization in server side. The server side app will require a RingCentral admin user to setup once. So the app can access account (company) level API with the admin user's token.

So for all users who want to make calls, they need authorize and use app with the embeddable (client side).
And for an admin user, the admin user needs to authorize and setup at your server side app to sharing company calls data in your app.

1 Like 1 ·

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