How to generate Authorization token for Historical API?
-
I have login details in loginDetails field:
const {feedToken,jwtToken,refreshToken} = loginDetails
const historyToken =Bearer ${feedToken}
var historyData = JSON.stringify({"exchange":"NSE","symboltoken":"3045",
"interval":"ONE_MINUTE","fromdate":"2021-02-08 09:00",
"todate":"2021-02-08 09:16"});var historyConfig = {
method: 'post',
url: 'https://apiconnect.angelbroking.com/rest/secure/angelbroking/historical/v1/getCandleData',
headers: {
'X-PrivateKey': apiKey,
'Accept': 'application/json, application/json',
'X-UserType': 'USER',
'X-SourceID': 'WEB',
'X-ClientLocalIP': '192.168.29.100',
'X-ClientPublicIP': '192.168.29.100',
'X-MACAddress': 'ac:50:db:dd:78:b1',
'Authorization': historyToken,
'Content-Type': 'application/json'
},
data : historyData
};
I am using feedToken but getting invalid token error. -
Hello @nlptechguy ,
Apologies for the delayed response. Please use the jwt token generated in the response to login API for this purpose.If you have any other issue, please share request and response on smartapi@angelbroking.com.
Regards
SmartAPI Team -
@nlptechguy just use jwt token for all api requests. feed token is only used for websocket
-
@nlptechguy Did you find any solution for the above issue?