question

Victor Rungta avatar image
Victor Rungta asked Jared Wood commented

Unable to refresh access token

App Type: Server/Web

curl Request:

curl --location --request POST 'https://platform.devtest.ringcentral.com/restapi/oauth/token' \

--header 'Content-Type: application/x-www-form-urlencoded' \

--header 'Authorization: Basic U0pDMTJQMDFQQVMwMHxBQUNxSkdJOW1pZDltYzhIRjJfMlVqTlY3di14WUZIYkFtR1Q2TlpVbjZzU3ZPc3JPdmRGVFJMNlpvWnZDbUJ6Q09oNF9QWWRPMEVYNENYQjd4dmJsWHJoWnlrSXJvM3ZieXM4RWFEc3FFZ0lVRzREa0NSelVRVTV6dGYyQVdWeWhkSDlvNHhLdlB3eUNNT010LVhJX1RjNE8zMXhJRzM5MnFPbFNYNVdFMnFwalllNFdjN0l2TS1rdTlJOFluRlpUZ09sdE16Q3JSMHJMbVI0TUZHVXNURDN8d2NJTW1BfDJNeTVtalRwZ1VtSEs1MjBIdG15M3d8QUE' \

--data-urlencode 'refresh_token=U0pDMTJQMDFQQVMwMHxBQUNxSkdJOW1pZDltYzhIRjJfMlVqTlY3di14WUZIYkFtR1Q2TlpVbjZzU3ZPc3JPdmRGVFJMNlpvWnZDbUJ6Q09oNF9QWWRPMEVYNENYQjd4dmJsWHJobjZBM3pZTEkyemc4RWFEc3FFZ0lVQ2V4dFY3WWpnMnN6dGYyQVdWeWhkSDlvNHhLdlB3eUNNT010LVhJX1RjNE8zMXhJRzM5MnFPbFNYNVdFMnFwalllNFdjN0l2TS1rdTlJOFluRlpUZ1BfUEhRQ3RxaUNGVVRsQjdtbG9uVXR8d2NJTW1BfHg0X2d1Wk1NcTdEWXFWc2lYbkVKTkF8QUE' \

--data-urlencode 'grant_type=refresh_token'


Response: 400 Bade Request

{

"error": "invalid_request",

"errors": [

{

"errorCode": "OAU-156",

"message": "Basic authentication header is missing or malformed"

}

],

"error_description": "Basic authentication header is missing or malformed"

}


Can you guys help me how to refresh access token.

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 Phong Vu edited

Your header is incorrect as you used the refresh token.

--header 'Authorization: Basic U0pDMTJQMDFQQVMwMHxBQUNxSkdJOW1pZDltYzhIRjJfMlVqTlY3di14WUZIYkFtR1Q2TlpVbjZzU3ZPc3JPdmRGVFJMNlpvWnZDbUJ6Q09oNF9QWWRPMEVYNENYQjd4dmJsWHJoWnlrSXJvM3ZieXM4RWFEc3FFZ0lVRzREa0NSelVRVTV6dGYyQVdWeWhkSDlvNHhLdlB3eUNNT010LVhJX1RjNE8zMXhJRzM5MnFPbFNYNVdFMnFwalllNFdjN0l2TS1rdTlJOFluRlpUZ09sdE16Q3JSMHJMbVI0TUZHVXNURDN8d2NJTW1BfDJNeTVtalRwZ1VtSEs1MjBIdG15M3d8QUE' \

The Authorization header must be a based64 encoded string of "client id" + ":" + " client secret"

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 Jared Wood commented

url: https://platform.devtest.ringcentral.com/restapi/oauth/token (POST)

Your Header:

Content-Type: application/x-www-form-urlencoded

Authorization: Basic <Base 64 of client id : client secret>

In your post body:

grant_type=refresh_token&refresh_token=<refresh token>

3 comments
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 ♦♦ commented ·

Incorrect!

To refresh a token you don't need to specify the username and password anymore!

0 Likes 0 ·
Anirban avatar image Anirban Phong Vu ♦♦ commented ·

@Phong Vu .. just realized that ... corrected .. thanks

0 Likes 0 ·
Jared Wood avatar image Jared Wood Anirban commented ·

This is exactly right. But does anyone know where it states this in the documentation? I've looked over every possible page and cannot come to this same conclusion on my own. Awful documentation.

1 Like 1 ·

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