shauna-minning3746 avatar image
shauna-minning3746 asked etam-singh8884 commented

Implementing the reauthentication flow

We are trying to implement the reauthentication flow.

I am attempting to use the Refresh Token Flow documented here -!#RefRefreshTokenFlow

I am hitting the following endpoint to refresh my access token - POST /restapi/oauth/token HTTP/1.1

My headers are the following - headers={"User-Agent"=>"Faraday v0.9.2", "Content-Type"=>"application/x-www-form-urlencoded", "Authorization"=>"Basic { {API_KEYS_HIDDEN_FOR_SECURITY_CONCERNS}}", "Application"=>"application/json"}

My body is the following -body={:client_id=>"{ {CLIENT_ID_HIDDEN_FOR_SECURITY_CONCERNS}}", :client_secret=>"{ {CLIENT_SECRET_HIDDEN_FOR_SECURITY_CONCERNS}}", :grant_type=>"refresh_token", :refresh_token=>"{ {REFRESH_TOKEN_HIDDEN_FOR_SECURITY_CONCERNS}}"}

However when I make a request I receive the following error -

API Error: invalid_client: Invalid client: { "error" : "invalid_client", "errors" : [ { "errorCode" : "OAU-153", "message" : "Invalid client: ", "parameters" : [ { "parameterName" : "client_id", "parameterValue" : "" } ] } ], "error_description" : "Invalid client: "}

Can you please advise as to what the error code "OAU-153" means and what the issue might be? The client_id is not blank, and the headers appear to be correct per the documentation linked to above.

1 |3000

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

benjamin-dean avatar image
benjamin-dean answered benjamin-dean commented
Looking at the documentation and your request information, it appears your request is malformed, the request body must contain the following x-www-form-urlencoded properties and values:

refresh_token: "{ {YOUR_PREVIOUS_REFRESH_TOKEN}}"
grant_type: "refresh_token"
endpoint_id: "{ {UNIQUE_CLIENT_ID}}" /** NOTE: Defaults to previously specified or auto-generated value if not provided **/

Make sure the Authorization: Basic { {BASE_64_ENCODED_API_KEYS_SEPARATED_BY_COLON}}

Try the above and see if this resolves your issues.
1 comment
1 |3000

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

Additionally, you might want to implement one of our official SDKs (which handle token refresh for you):
0 Likes 0 ·
shauna-minning3746 avatar image
shauna-minning3746 answered etam-singh8884 commented
Ah, thank you Benjamin. We tried those solutions previously but will give it another shot and reply if we get stuck again.
1 |3000

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

We are seeing some intermittent 504 issues with the API (no reports of receiving these with Authentication/Authorization endpoints currently), and we are also seeing some issues with Softphones not being able to obtain or maintain connectivity when used with Sandbox accounts.

Not sure if this will impact you in this work, but just sharing as there may be TBD related issues. You can follow this thread for more information and updates on the 504 timeouts:
0 Likes 0 ·
Ah, we will look into this Benjamin, this might be helpful
0 Likes 0 ·
Hi Shannu.Is the above solution work for u.I am also facing same issue.

If Yes,Can u please share your code that how u implemented

0 Likes 0 ·

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