I have these two code to get the access_token
- Using fyers.generate_access_token()
const fyers_access_token = await fyers.generate_access_token(reqBody)
- Using API
const concatenatedString = process.env.FYERS_APP_ID + process.env.FYERS_SECRET_ID;
console.log(concatenatedString);
const hash = crypto.createHash('sha256').update(concatenatedString).digest('hex');
const refreshToken = await fetch('https://api.fyers.in/api/v2/validate-refresh-token', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
grant_type: 'refresh_token',
appIdHash: hash,
refresh_token: decryptedCredentials.refresh_token,
pin: ****
})
})
In step 2, I want access_token without giving a PIN. How can I do this in Javascript?
OR is there any other way to get the access_token token other than the one above?