Question

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

  • 1 June 2021
  • 1 reply
  • 613 views

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.


1 reply

Userlevel 1

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.

Reply