ringcentral / ringcentral-embeddable

RingCentral Embeddable widget
https://apps.ringcentral.com/integration/ringcentral-embeddable/latest/index.html
MIT License
78 stars 52 forks source link

Unable to authorize code #914

Open MinhQuanGRF opened 1 week ago

MinhQuanGRF commented 1 week ago

I'm processing the login, and getting the authorization code. I then authorize that code by:

 postMessage({
      type: 'rc-adapter-authorization-code',
      callbackUri: `http://localhost:3000/admin/ring-central-mobile?code=${code}`,
 });

then got error:

{
  "error" : "invalid_redirect_uri",
  "errors" : [ {
    "errorCode" : "OAU-109",
    "message" : "Redirect URIs do not match"
  } ],
  "error_description" : "Redirect URIs do not match"
}

even though the link http://localhost:3000/admin/ring-central-mobile has been added by me to the OAuth Redirect URI

MinhQuanGRF commented 1 week ago

@embbnux Could you please assist?

embbnux commented 1 week ago

hi @MinhQuanGRF do you pass your redirect uri to Embeddable? https://ringcentral.github.io/ringcentral-embeddable/docs/config/redirect-uri/ The code needs to be matched with redirect uri in the widget.

MinhQuanGRF commented 6 days ago

I have tried:

    postMessage({
      type: 'rc-adapter-authorization-code',
      callbackUri: `https://apps.ringcentral.com/integration/ringcentral-embeddable/latest/redirect.html?code=${code}`,
    });

However it also fails: image image image

But if I use rc-adapter-login, I can still login: image image

Do you notice what problem I'm having?

embbnux commented 5 days ago

Hi @MinhQuanGRF can you show how you get the code? If you get the code from your own redirect URI, you need to pass your redirect uri to the widget following the document that I share in last comment