News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Invalid client error while calling refresh token api
Tags: error
Sep 20, 2016 at 1:49am   •   7 replies  •  0 likes
mahesh-more

Hi All,


I am calling refresh token api to refresh token. But when I call, It throws error "Invalid client: ".

I am calling using node js.Below is calling function.


request.post( { url : ringCentralUrl,

form: {

refresh_token : myRefreshToken,

grant_type : "refresh_token",

endpoint_id: endpointId

},

headers:{


"Authorization" : "Basic MyaccessToken",

'Accept':'application/json',

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

}

},function(err,responce, responceData) {




});


Can anyone please help me out.



----

Thanks,

Mahesh More

7 Answers
answered on Jun 22, 2019 at 1:16pm  

Yes you don't need to put access_token in Authorization header. All you need to put is Base64 format of clientId and client secret as follow:

Authorization Basic <clientId:clientSecret in Base64>

Access_token are need to pass to the actual main APIs as type Bearer to get the response


 0
answered on Jun 21, 2019 at 2:54am  

Yes, you don't need to use access_token in Authorization header after Basic tag.. it is meant for base64 format of clientId: clientSecret

Remaining parameters are just fine.. the format should be

username=<account phone number>&password=<account password>&extension=<your extension>&grant_type=refresh_token&refresh_token=<Your refresh token>


 0
answered on Feb 25, 2018 at 9:11am  
Mahesh More,have you get the solution.Have you get the solution to refresh the access token?
If yes please share code.Thanks

 0
answered on Oct 3, 2016 at 9:29am  
You will need to view the documentation, because Tyler is correct, you are using the incorrect Authorization Header key:value. https://developers.ringcentral.com/api-docs/latest/index.html#!#RefRefreshTokenFlow

What this means is in your example you set the "Authorization: Basic {{myAccessToken}}", but this is incorrect because you SHOULD NOT be using your "access_token" as this value, you should instead be using the result of Base64 encoding your {{appKey}}:{{appSecret}} (which is the same value you used to obtain the 'access_token' initially).

Also, please pay special attention to the description for endpointId...
If not specified, the previously specified or auto-generated value is used by default

 0
answered on Oct 3, 2016 at 2:13am  
I am not using SDK.
I have entered endpointId value which I got it with access token.

Below is the error I am facing.

 {
  "error" : "invalid_client",
  "error_description" : "Authentication header value is malformed"
}



Please do let me know if you need more information.



 0
answered on Sep 20, 2016 at 9:31am  
Could you please provide the following:

1. Are you using the RingCentral JS SDK? If yes, which version?
2. Description of the 'endpointId' variable's assigned value
3. The complete error response with headers/body from this request

This will help in figuring out what is happening here.

 0
answered on Sep 20, 2016 at 3:39am  
Hello Tyler,

MyaccessToken I have generated using RingCentral OAuth 2.0 Authentication.

Do you mean I am using wrong appKey or appSecret while generating access token ?

Thanks,
---
Regards,
Mahesh More




 0
answered on Sep 20, 2016 at 3:18am  
It probably means your appKey or appSecret is wrong.

In your code there is "MyaccessToken", how did you generate it?

 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us