question

nick-lagerquist5249 avatar image
nick-lagerquist5249 asked ·

curl command for requesting access token

What is the curl command for requesting an access token using Password Flow?
General Topicfrequently asked
1 |1000 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.

Julio Toledo avatar image
Julio Toledo answered ·
curl -X POST "https://platform.ringcentral.com/restapi/oauth/token" 
-H "Accept: application/json"
-H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Basic <access-token>" -d "username=<user-phone-number>&password=<user-password>&extension=<user-extension>&grant_type=password
Source:
https://developer.ringcentral.com/api-docs/latest/index.html#!#RefPasswordFlow
6 comments
1 |1000 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.

You don't need to manually do base64 encoding:
curl -X POST "https://platform.devtest.ringcentral.com/restapi/oauth/token"; \
-H "Accept: application/json" \
-H "Content-Type: application/x-www-form-urlencoded" \
-u "<appKey>:<appSecret>" \
-d "username=<username>&password=<password>&extension=<extension>&grant_type=password"
1 Like 1 ·
Oops, by "<access-token>" I meant to say Base64 Encoded appKey + appSecret
0 Likes 0 ·
Awesome! So then the -u option implies "Basic" auth.
0 Likes 0 ·
Thanks for the responses. That solved that problems I was having.
0 Likes 0 ·
Hi all,Still i got Unauthorized for this grant type
0 Likes 0 ·
Show more comments
Anirban avatar image
Anirban answered ·

Here the problem you are facing is the header Authorization which is Basic <base64 of appKey:appSecret> .. If you pass that header in curl, your problem will be solved

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

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.