question

hardik-joshi6230 avatar image
hardik-joshi6230 asked Tyler Liu answered

Issue in authorization c# SDK

Hi, i am having issue with authorization when using c# SDK. i am using below code to get access token from c#.

using RingCentral;   

rc = new RestClient("appKey", "appSecret");


var tokenResponse = rc.Authorize("username", "extension", "password");


i am getting status in tokenResponse always "waitingForActivation" whether using any appKey or appSecretKey or any user name password does not matter.


every time i am getting same response in status that "waitingForActivation".


we have already install RingCentral nuget package into our project.


please help me on it


sdk
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

paco-vu avatar image
paco-vu answered
It should work with the following code.

await rc.Authorize("username", "extension", "password");
// get the token if you want to
var tokenString = rc.token.access_token;

+ Paco
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Tyler Liu avatar image
Tyler Liu answered
Could you please post the full response message? (Including the HTTP status code and error message code).

It's not a NuGet issue as long as you can compile your app.


1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

hardik-joshi6230 avatar image
hardik-joshi6230 answered
Above mention error got changed after applying "await" now Its giving me below error

Request to https://platform.devtest.ringcentral.com/restapi/oauth/token failed with status code 400 (Bad Request).

ErrorResponseBody : 
{
  "error" : "unauthorized_client",
  "error_description" : "Unauthorized for this grant type"
}

1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

paco-vu avatar image
paco-vu answered
It's probably because you selected a wrong platform type for your app. If you expect to login from your server code then choose the "Server-only" type. See this reference for more details about platform type ( https://developer.ringcentral.com/library/getting-started.html#/#PlatformTypes)

Now you can create a new app with a correct platform type and try again.

+ Paco
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Tyler Liu avatar image
Tyler Liu answered
You can search this forum by keyword "grant type" and check the history issues. You are not alone.
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys