Embedded Voice oauth error

  • 1
  • Problem
  • Updated 8 months ago
Following yesterdays webinar on Embedded Voice, I am trying to integrate this into our CRM. I have created test page with  a copy of the example code, but i keep receiving an oauth error. Please can someone advise? Thanks in advance.

include code:
 <script>
  (function() {
    var rcs = document.createElement("script");
    rcs.src = "https://ringcentral.github.io/ringcentral-embeddable-voice/adapter.js?appKey=itC6A58EQYS0ae-w480bCg&...;
      var rcs0 = document.getElementsByTagName("script")[0];
    rcs0.parentNode.insertBefore(rcs, rcs0);
  })();
</script>

the error code I receive is:
oauth error:  Error: invalid_request
    at o (app.js:1)
    at t.<anonymous> (app.js:1)
    at r (app.js:1)
    at Generator._invoke (app.js:1)
    at Generator.e.(ringcentral.github.io/ringcentral-embeddable-voice/anonymous function) [as next] (https://ringcentral.github.io/ringcentral-embeddable-voice/app.js:1:1191401)
    at r (app.js:1)
    at app.js:1
    at new Promise (<anonymous>)
    at new t (app.js:1)
    at t.<anonymous> (app.js:1)
(anonymous) @ app.js:1
r @ app.js:1
(anonymous) @ app.js:1
e.(anonymous function) @ app.js:1
r @ app.js:1
(anonymous) @ app.js:1
t @ app.js:1
(anonymous) @ app.js:1
e @ app.js:1
r @ app.js:1
(anonymous) @ app.js:1
r @ app.js:1
(anonymous) @ app.js:1
e.(anonymous function) @ app.js:1
r @ app.js:1
(anonymous) @ app.js:1
t @ app.js:1
(anonymous) @ app.js:1
e @ app.js:1
(anonymous) @ app.js:1
r @ app.js:1
(anonymous) @ app.js:1
e.(anonymous function) @ app.js:1
r @ app.js:1
(anonymous) @ app.js:1
t @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
postMessage (async)
window.oAuthCallback @ proxy.js:1
(anonymous) @ ringcentral.github.io/ringcentral-embeddable-voice/redirect.js:1
Photo of Nick Buchanan

Nick Buchanan

  • 162 Points 100 badge 2x thumb

Posted 8 months ago

  • 1
Photo of Embbnux Ji

Embbnux Ji

  • 270 Points 250 badge 2x thumb
Hi, Nick. From the error message, it seems that you provide a valid `appKey`. Would you please check the appKey in RingCentral Developer Website. I also try with your appKey.

Got following message from RingCentral API:

{
  "error" : "invalid_client",
  "error_description" : "Invalid client: itC6A58EQYS0ae-w480bCg",
  "errors" : [ {
    "errorCode" : "OAU-153",
    "message" : "Invalid client: itC6A58EQYS0ae-w480bCg",
    "parameters" : [ {
      "parameterName" : "client_id",
      "parameterValue" : "itC6A58EQYS0ae-w480bCg"
    } ]
  } ]
}
Photo of Nick Buchanan

Nick Buchanan

  • 162 Points 100 badge 2x thumb
Hi Embbnux,
I can confirm that the API Key is coorect. I have attached a snippet below...
Photo of Embbnux Ji

Embbnux Ji

  • 270 Points 250 badge 2x thumb
If you just want to test the widget, you can remove configure params as following:

  (function() {
    var rcs = document.createElement("script");
    rcs.src = "https://ringcentral.github.io/ringcentral-embeddable-voice/adapter.js";
    var rcs0 = document.getElementsByTagName("script")[0];
    rcs0.parentNode.insertBefore(rcs, rcs0);
  })();

It will use default config params.
Photo of Nick Buchanan

Nick Buchanan

  • 162 Points 100 badge 2x thumb
Yeah, i tried that and received the same error!?
Photo of Embbnux Ji

Embbnux Ji

  • 270 Points 250 badge 2x thumb
It's strange. I just test it with default params. It works for me. Can you go to this page to check if it works for you https://ringcentral.github.io/ringcentral-embeddable-voice/

And can you provide more detail about how you use it. 
Photo of Nick Buchanan

Nick Buchanan

  • 162 Points 100 badge 2x thumb
OK, following your link:
Click on "Sign In" in the RC popup.
Opens the RC Sign In popup (https://service.ringcentral.com/login/unifiedLogin.html?session=-889812755084094010&responseType...)
n.b. this looks like the url for live rather than dev, is that correct?
Enter my credentials.
The Access Authorisation shows.
Click Authorise, and the popup disappears. I am left with the original RC popup with the "Sign In" button.
Photo of Nick Buchanan

Nick Buchanan

  • 162 Points 100 badge 2x thumb
Additional:
I have also tried amending the params to just include the dev AppServer and this sent me to the correct Sign In page, but again, after I signed in using my sandbox credentials, and then Authorised the access, it left me with the Log In button and showed that oauth error in the console...
Photo of Embbnux Ji

Embbnux Ji, Employee

  • 1,268 Points 1k badge 2x thumb
Hi, Nick. For default configuration, it uses production environment. And free developer account doesn’t have permissions to login https://github.com/ringcentral/ringcentral-embeddable-voice/issues/97 you can follow this issue link to change it to use sandbox environment.
And can you show error messages from browser console to find what cause login fail. For your client id, Does it support implicit flow, you can check in RingCentral developer website
Photo of Embbnux Ji

Embbnux Ji

  • 270 Points 250 badge 2x thumb
Hi, Nick. Now the app can open the login window with your app client id. But it seems that your client id is in wrong brand. Now RingCentral Embeddable Voice is in RingCentral brand. Can you check if your app support RingCentral brand. It is selected when you created this app. You can check it in RingCentral developer website. 
Photo of Nick Buchanan

Nick Buchanan

  • 162 Points 100 badge 2x thumb
Hi,
here i a screenshot of  the app showing its permissions etc.

Photo of Embbnux Ji

Embbnux Ji

  • 270 Points 250 badge 2x thumb
Oh, find the problem. Please create a new Public app with Carrier `RingCentral`.  
Photo of Embbnux Ji

Embbnux Ji

  • 270 Points 250 badge 2x thumb
I will check with my colleagues why this app doesn't support private app
Photo of Nick Buchanan

Nick Buchanan

  • 162 Points 100 badge 2x thumb
Thank you. Creating a public app has enabled me to log in.
I now see a message saying "Web Phone Unavailable" - Please grant RingCentral Embeddable Voice to access your audio. Where do I enable this please?

It would be useful to have these steps and requirements mentioned in the online documentation/tutorial.
Photo of Embbnux Ji

Embbnux Ji

  • 270 Points 250 badge 2x thumb
Yes, we need to add it to tutorial. For message from this widget, you need to make browser allow this app to use microphone. It should popup alert window in the browser. It will not pop up when browser block it. You can go to `chrome://settings/content/microphone` to diable block and enable it.
Photo of Nick Buchanan

Nick Buchanan

  • 162 Points 100 badge 2x thumb
Hi, yes that solved the problem.
Thank you very much for your help. No I can try and extend the functionality within our CRM.
Does this support the functionality to instigate a call (via click-to-dial), and then at the end of the call grab the call recording ID so that i can then automatically download it and attach to the customers record in our CRM?
Photo of Nick Buchanan

Nick Buchanan

  • 162 Points 100 badge 2x thumb
Hi
Photo of Tyler Long

Tyler Long, Official Rep

  • 8,916 Points 5k badge 2x thumb
Hi, I am having problem with implicit grant flow too. 

Nick, could you please inspect the network in Chrome devtools and post the network response here?

I want to confirm that we are talking about the same issue.
Photo of Tyler Long

Tyler Long, Official Rep

  • 8,916 Points 5k badge 2x thumb
The issue disappeared on my side.
Photo of Nick Buchanan

Nick Buchanan

  • 162 Points 100 badge 2x thumb
Hi, Did you change anything at your end, or did it just begin to work?