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

Hey @103779908418501293694 ,

As per the details you have given above , you are using the access token in the inputs instead of the refresh token , When you hit this ‘validate-authcode’ you will get both access token and refresh token in the response , please use the refresh token from it

Hi @WWhYB2qrsx ,

I am also facing the same issue. I am using refresh token from validate-authcode api.

Hi @103779908418501293694 ,

How are you getting NSE data from NSE site using google app script.