Facing issues when trying to "Refresh Token" to get new token

I am working with some automations in google App scripts for FYERS APIs,

I have the authentication working but when writing a function to do token refresh via the token for token method I get the following error:

Request endpoint: https://api-t1.fyers.in/api/v3/validate-refresh-token

HTTP Code: 400 with a response:

{"code":-501,"message":"Please provide valid refresh token","s":"error"}

Here is my payload sent:

payload={"grant_type":"refresh_token",

"appIdHash":"--SNIPPED this works for other requests fyi--",

"refresh_token":--PREVIOUSLY VALID TOKEN OBTAINED FROM 'validate-authcode' ENDPOINT which is used and work for other endpoints such as 'profile' etc",

"pin":"----"},

method=POST, contentType=application/json

Please help !!
document used: https://myapi.fyers.in/docsv3#tag/Authentication-and-Login-Flow-User-Apps/paths/~1Authentication%20&%20Login%20Flow%20-%20User%20Apps/delete

2
3 replies