Following code :
var rc = new RestClient(appConfig.RingCentralClientId, appConfig.RingCentralClientSecret, appConfig.RingCentralApiServerUrl);
TokenInfo tokenInfo = await rc.Authorize(code, productDomain + ringCentralOauthTokenCallbackUrl); // "code" comes from RingCentral response to initial call to "AuthorizeUri".
Results in the following error:
Call failed with status code 400 (Bad Request): POST https://platform.devtest.ringcentral.com/restapi/oauth/token
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Flurl.Http.FlurlHttpException: Call failed with status code 400 (Bad Request): POST https://platform.devtest.ringcentral.com/restapi/oauth/token
Stack Trace:
[FlurlHttpException: Call failed with status code 400 (Bad Request): POST https://platform.devtest.ringcentral.com/restapi/oauth/token] Flurl.Http.<HandleExceptionAsync>d__23.MoveNext() +565 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +48 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +230 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +143 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +50 System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +40 Flurl.Http.<SendAsync>d__19.MoveNext() +2946 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +48 Flurl.Http.<SendAsync>d__19.MoveNext() +3738 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +48 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +230 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +143 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +50 System.Runtime.CompilerServices.ConfiguredTaskAwaiter.GetResult() +40 Flurl.Http.<ReceiveJson>d__0`1.MoveNext() +392 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +48 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +230 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +143 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +50 System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +40 RingCentral.<Authorize>d__44.MoveNext() +487 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +48 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +230 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +143 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +50 System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +40 AsclepiusWeb.Core.Service.CallRecords.CallerIqPlugins.<getAccessTokens>d__7.MoveNext() in C:devasclepiussourceAsclepiusWebCoreServiceCallRecordsCallerIqPluginsCallerIqPluginService.cs:52 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +48 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +230 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +143 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +50 System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +40 AsclepiusWeb.Areas.clients.Controllers.<ringCentral>d__2.MoveNext() in C:devasclepiussourceAsclepiusWebAreasclientsControllersCallerIqOAuthController.cs:27 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +48 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +230 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +143 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +50 System.Runtime.CompilerServices.TaskAwaiter.GetResult() +30 System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task) +63 System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +114 System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult) +66 System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +137 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +49 System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +117 System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +323 System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +323 System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +323 System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +323 System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +323 System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +323 System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +44 System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +137 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50 System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +72 System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +185 System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +42 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +134 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40 System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +134 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44 System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +39 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +62 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +134 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39 System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +39 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +134 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38 System.Web.CallHandlerExecutionStep.InvokeEndHandler(IAsyncResult ar) +279 System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +153