question

robert-raj8062 avatar image
robert-raj8062 asked Anirban Sen Chowdhary 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>
topic-default
1 |1000

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 |1000

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

Anirban Sen Chowdhary avatar image
Anirban Sen Chowdhary 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 |1000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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