News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
RingCentral.NET Mismatched Redirect URI error with matching URIs.
Tags: rest api
May 14, 2021 at 8:24am   •   2 replies  •  0 likes
Dylon Price

I'm working on developing an integration with RingCentral's API and am using the RingCentral.NET nuget package, along with the AuthorizeUriExtension.

When attempting to call authorizeUriExtension.BuildUri(), I'm passing in the AuthorizeRequest object as expected, and filling that with a redirect uri. As this integration is currently in development, I am using ngrok to tunnel to localhost and give the API something to redirect to. Code sample below for this call.


// NOTE: _rc below is my restClient variable from RingCentral.NET
public string GetLoginUrl()
{
    var authorizeUriExtension = new AuthorizeUriExtension();
    _rc.InstallExtension(authorizeUriExtension);
    return authorizeUriExtension.BuildUri(new AuthorizeRequest
    {
        redirect_uri = "https://[randomNgrokStringHere].ngrok.io/Home/Index"
    });
}


On attempting this call, however, I get an error back about there being a mismatch between the redirect_uri value that I'm sending, and the Redirect URI in App > Settings > OAuth Redirect URI--even though the Redirect URI in settings is character for character identical.

I will note that previously I was having no issues with this, and all of a sudden despite the matching URI it is suddenly throwing errors that they do not match.

2 Answers
answered on May 14, 2021 at 10:45am  

Hi @Phong Vu!

Well, this worked with ngrok previously--so I'm unsure why it would suddenly not be. However, I did just test by changing to using localhost as my callback (and updating both my code and the uri in the settings page for my app) and was greeted by the same error. Error text is below.

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

As a sanity check, I've attached a screenshot of both the code calling the sdk, and the relevant setting.
2021-05-14-13-42-32-ringcentralapitest-microsoft-v.png

2021-05-14-13-42-58-ringcentral-developers.png


 0
on May 14, 2021 at 11:19am   •  1 likes

It would take some time to get the new redirectUri in effect. Try it again in an hour or so.

on May 14, 2021 at 12:51pm   •  0 likes

Give it a little over an hour, and unfortunately I have the same result--OAU-109 error code.

on May 14, 2021 at 2:16pm   •  0 likes

I have to trust the error message. Either the system still has not updated the app setting or there is a mismatch somewhere.

on May 18, 2021 at 4:38am   •  1 likes

Good morning!

Apologies for the delay--I was out sick yesterday. You were correct that the system had just not updated, after logging in this morning I was able to connect correctly using localhost as my uri. Appreciate your help in pointing me in that direction! Previously it had updated fairly quickly, so I was quite confused as to why all of a sudden nothing was working. I'll mark your answer as accepted.

Thanks!

on May 14, 2021 at 11:31am   •  0 likes

Sounds good, I will try again in an hour! Previously with ngrok I had multiple hours between tests, but I'll try that again just using localhost.

answered on May 14, 2021 at 10:36am  

You don't need to use ngrok tunnel for your test app redirectUri. If you run it locally, use localhost with your own port number. Make sure to change the redirectUri in your app settings. E.g.

"http://localhost:5000/oauth2callback";

https://developers.ringcentral.com/guide/authentication/quick-start#c#


 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us