Oauth Refresh Token Problem

Hi Team,

I hope all of you are safe and doing well.

I am trying to integrate with Sprinklr, when I used their Oauth in local, everything worked well, but when I published this as a custom app, am getting the following error:
“The refresh_token is invalid”
this is their refresh token logic. https://developer.sprinklr.com/docs/read/authorize/Refreshing_Access_Token
am I missing something or doing something wrong.

Please help me out on how to get this resolved.

Hi Nithin,
I hope you removed the {{env}} from the url while running in production environment. Let us know if this doesn’t solve the problem.

1 Like

Am still testing against their staging environment. and i have hard coded the values for {{env}}.

Hi Nithin,
Is it possible to share the code snippet where you are calling the sprinklr OAUTH API? Also, can you please post a screenshot of the error response along with the logs of your app?

`const makeRequest = async function(url, apiSecret, data) {
 var headers = {
   Authorization: "Bearer <%= access_token %>",
   "Content-Type": "application/json",
   "accept": "application/json",
   Key: apiSecret,
};
return $request.post(url, {
  headers,
  isOAuth: true,
   body: JSON.stringify(data),
 });
}`

Error Message:

error { status: 400, response: '{"error_description":"The refresh_token is invalid","error":"invalid_token"}', headers: {}, errorSource: 'PLATFORM' }

Hi Nithin,
We are seeing that our system is unable to refresh tokens as the original refresh token we got is an invalid one. We also saw that the custom app you have built is an account level oauth app. If so, can you please reauthorize the app in settings and try again?

Hi Mani,

Even after reauthorizing multiple times, the app didn’t work. I am getting the same error.

Nithin

Hi Nithin,
We observed that the custom app made no such requests for reauthorisation from yesterday ( when it got installed ). Can you please check while reauthorising if it is success as well as no error logs are present in browser console.

Hi Mani,
This issue is resolved. we’ll let you know if i come across the issue again.
Thanks.