Question

Web-phone-js integration with external system using Admin JWT authentication.

  • 31 July 2023
  • 2 replies
  • 110 views

I have a Lead management system; I need to integrate Ringcentral with that.

When a staff clicked a lead call button, start the call from browser. and also they need to take an incoming call from browser. If the staff is not available in front of the system, Call will forward to the phone we already mapped.


I am the admin of this Lead manager and I will configure the Ringcentral App details in LeadManager Settings. Staff don't need to authenticate with Ringcentral again.


1. Is this possible with RingCentral ?

2. I tried with web phone JS, But it looks like need to authenticate for each user.

3. I am using PHP & JS for implement this. When I configure app credentials in JS, public can access that. Instead, any option to authenticate from server and use token for JS ? And I noticed only 5 auth request limit also there.


Someone please assist me with this issue.


2 replies

Userlevel 1

I think you can do that if you implement the authentication using JWT token in the backend and provide a secure way to get the valid tokens from the backend whenever you need to call the platform APIs.

To do that, remove the login function from the client side, and provide a method to get the tokens (you will have to handle multiple users to make sure that your backend returns the right tokens to the right user). Once you have a valid tokens, set the tokens to the platform object and call any API. Here is my untested example. /getToken is your server method that login and return the tokens object.

function getTokens(userId) {
    var getting = $.get( `getToken?userId=userId` );
    getting.done(function( res ) {
      if (res.status == "ok") {
          platform = sdk.platform();
                        await platform.auth().setData(res.tokens)
                        // Call platform API
      }else if (res.status == "error"){
        // handle error
      }
    });
}

Thanks for the support, I will try this way, and update here.

Reply