I'm using the latest official C# SDK in a new ASP.NET Core 2.0 web application. Although the SDK isn't built to the same target framework, the app compiles and seems ok. I've tried just about every setting (public/private, web, web/ui, etc.) but I always get the following error:
FlurlHttpException: Request to https://platform.devtest.ringcentral.com/restapi/oauth/token failed with status code 400 (Bad Request).
I'm using simple code which appears the same as the SDK sample:
var restClient = new RestClient(appKey, appSecret, appUri);
await restClient.Authorize(userName, extension, password);
If you're able to look up my account info to verify, the sandbox values I'm using are:
- appKey = f6v********-61******kw
- appSecret = JR****u_QG**************TxA
- appURI = https://platform.devetest.ringcentral.com
- userName = +1313*****01
- extension = 101
- password = 1rc********st!
All the above are from the sandbox app credentials. I wish I received something more back, but I just get "400 (Bad Request)". I'm sure it's something dumb I'm doing, it is rather confusing figuring out what values are needed when they are called different things in different places.
Any help is greatly appreciated, I've scoured the community forum and the web. It seems that this error is generally from people not using the sandbox credentials, or the wrong password, but I've changed the sandbox password a zillion times, to no avail.
Thank you!
var restClient = new RestClient(appKey, appSecret, appUri);
await restClient.Authorize(userName, extension, password);
var requestBody = new
{
text,
from = new { phoneNumber = from },
to = new object[] { new { phoneNumber = to } }
};
var rcExtension = restClient.Restapi().Account().Extension();
var response = await rcExtension.Sms().Post(requestBody);
if (response.messageStatus == "Queued" && response.deliveryErrorCode == null)
{
return true;
}
else
{
return false;
}
The arguments/vars of 'appKey', 'appSecret', 'appUri', 'userName', 'extension' and 'password' are passed in from my appsettings.json and 'from', 'to', and 'text' are passed in from the caller. All would obviously need set by you.
+ Phong
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