question

Anand Patel avatar image
Anand Patel asked Samyukta Bharadwaj answered

OAU-251 - JWT - Unauthorized for this grant type

Created JWT and trying to use this.


App I am using is the only App in Production for sending SMS.

Using Rest Client with C#


restClient = new RestClient(
                "RC_CLIENT_ID",
                "RC_CLIENT_SECRET",
                "https://platform.ringcentral.com");
var jwt = @"REMOVED FOR SECURITY";
var tokenInfo = await restClient.Authorize(jwt);
Response:
StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
  Server: nginx
  Date: Fri, 11 Nov 2022 23:44:07 GMT
  Connection: keep-alive
  Vary: Origin
  Vary: Access-Control-Request-Method
  Vary: Access-Control-Request-Headers
  RCRequestId: bbd807d0-621a-11ed-884a-0050568d7d0d
  Pragma: no-cache
  Cache-Control: no-store
  AceRoutingKey: iad41-c01-ace01-f7db789cc-xzsz9_10.120.155.210
  RoutingKey: SJC01P13
  Content-Type: application/json
  Content-Length: 201
  Content-Language: en
}
Content: {
  "error" : "unauthorized_client",
  "errors" : [ {
    "errorCode" : "OAU-251",
    "message" : "Unauthorized for this grant type"
  } ],
  "error_description" : "Unauthorized for this grant type"
}

Request:
Method: POST, RequestUri: 'https://platform.ringcentral.com/restapi/oauth/token', Version: 1.1, Content: System.Net.Http.FormUrlEncodedContent, Headers:
{
  X-User-Agent: Unknown/0.0.1 RingCentral.Net/5.18.0
  Authorization: Basic REMOVED FOR SECURITY
  traceparent: 00-e7fec9cf088e5a8849d254c03b4eea14-a20c80fc5b02ce2f-00
  Content-Type: application/x-www-form-urlencoded
  Content-Length: 770
}
Content: grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=REMOVED-FOR-SECURITY
authentication
1 |3000

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

Phong Vu avatar image
Phong Vu answered

What is the platform type of your app? Or what is the app client id?

1 |3000

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

Samyukta Bharadwaj avatar image
Samyukta Bharadwaj answered

Hi @Anand Patel, this could have something to do with your app settings, please submit a case here along with your client id

https://developers.ringcentral.com/support/create-case for further investigation on the error message.

1 |3000

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