I have written a code in python to get option chain data through API, this code requires authorization code (manually i generate and update) which eventually create access token and gets the option chain data. I have put this in loop to run the code every 5 minutes automatically. however my authorization code gets expire after 3-4 minutes and my code break please help to resolve.
@Ajay_Rahangdale The authorization code is short-lived and can only be used once. However, you donāt need to generate an access token every time. Once generated, the access token remains valid until 3:30 AM the next day, allowing you to use it throughout the day without needing to regenerate it.
Thanks Pradeep for your response, I did try that.
First I have got the access token with separate code (by using authorization code), then the same access code i have used in my main code. it still throw the same error -
401
Also, when i generate the access token with the help of authorization code it comes different everytime, is it expected?
Yes, the access token will be unique each time itās generated. Could you please share your UCC so we can look into the 401 issue?
Hi Pradeep
Issue resolved and now access token is not expiring, in first attempt i had not got the correct access token. Thanks for your help.