Kite Login issue | Multiple logins required

deepaknesarikar
I am using python client for login. But everyday morning, i need to login multiple times in order to perform LTP / Profile API call successfully.

Heres my Login and capturing access token code. Is there some thing wrong i am doing ?

FOR LOGIN
@app.route("/login")
def login():
login_url = kite.login_url()
# Redirect to a specific URL (e.g., the home page or another route)
return redirect(login_url)

FOR CAPTURING TOKEN
@app.route("/catch_request_token", methods=["GET"])
def catch_request_token():
status = request.args.get("status")
logging.info(f"request for request token with status {status}")
if status != "success":
return f"Error in generating token {status}"

request_token = request.args.get("request_token")
logging.info(f"request token parsed")
try:
data = kite.generate_session(request_token, api_secret=Config.API_SECRET)
logging.info(f" Generate session done with data= {data}")
kite.set_access_token(data["access_token"])
logging.info("Access token set successfully")
return "Access token set successfully"
except Exception as e:
logging.error(f"Error generating session: {e}")
return f"Error generating session: {e}"

My API call returns "Access token set successfully". But after trying to retrive LTP , it says invalid API key or Access token. After I retry the login, it works. Everyday , i need to do login twice or thrice in order to make the LTP or Profile API work
  • rakeshr
    Everyday , i need to do login twice or thrice in order to make the LTP or Profile API work
    Make sure, you do not have multiple sessions active. Go through the login FAQs here.
Sign In or Register to comment.