question

Roshna N avatar image
Roshna N asked Phong Vu answered

Authention issue while getting token using Auth code ,3-legged oauth code flow error

Hi All,

We are using the 3-legged api flow mentioned in the below documentation.
REFERENCE URL: https://developers.ringcentral.com/guide/authentication/auth-code-flow

STEP 1: Login URL, where user is redirected to the ringcentral login page for authentication and concent.

https://platform.ringcentral.com/restapi/oauth/authorize?response_type=code&redirect_uri=<my_uri>&client_id=<client_id>&display=&prompt=

STEP 2: We are successfully receiving the code in response to our redirect URI specified. When we make a second request to receive the token we are getting the following error message.

*REQUEST URL:* https://platform.devtest.ringcentral.com/restapi/oauth/token

*REQUEST TYPE:* POST

*REQUEST HEADER*

"Accept"=> "application/json",
"Content-type"=>"application/x-www-form-urlencoded; charset=UTF-8",
"Content-Length"=>144,
"Authorization"=>"Basic BASE64CODE({CLIENTID}:{ CLIENTSECRET})

*REQUEST BODY PARAMETERS*
"grant_type" => "authorization_code",
"code" => {RECEIVEDCODE},
"client_id" => {CLIENTID},
"redirect_uri" => {REDIRECTURL},

*RESPONSE WE ARE GETTING*

{
"error" : "invalid_grant",
"errors" : [ {
"errorCode" : "OAU-222",
"message" : "Account does not exist"
} ],
"error_description" : "Account does not exist"
}

Please let us know the solution to this.

Thanks in advance.

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.

1 Answer

Phong Vu avatar image
Phong Vu answered

Everything looks correct. Just double check your parameters and retry. Or use one of the RingCentral SDKs to try and make sure you can login with your app and user credentials.

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