question

robert-raj8062 avatar image
robert-raj8062 asked Anirban answered

Curl restapi/oauth/token "errorCode" : "OAU-251", "message" : "Unauthorized for this grant type"

we have try to get auth token from RingCentral auth token(/restapi/oauth/token) by using CURL call but we have get

curl -X POST "https://platform.devtest.ringcentral.com/restapi/oauth/token" -H "Accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -u "clineId:clientpassword" -d "username=username&password=password&extension=101&grant_type=password"<br>
rest apierrorsauthentication
1 |3000

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
curl -i -X POST " https://platform.devtest.ringcentral.com/restapi/oauth/token"; \
-H "Accept: application/json" \
-H "Content-Type: application/x-www-form-urlencoded" \
-u "appId:appSecret" \
-d "username=username&password=password&extension=&grant_type=password"

Above is what I have tested

I think what you posted is correct. Because it is the same as mine.
1 |3000

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

Anirban avatar image
Anirban answered

Make sure the application you created supports Password flow since your (grant_type=password) .

Please note here, application created with different platform type will have different grant_type.

for more info, here is wonderful way it has answered with animated Gif image that will easily help you to understand the process:

https://stackoverflow.com/questions/47692828/ringcentral-auth-token-failed-in-curl-call-unauthorized-for-this-grant-type/47745436#47745436

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