Access Token Expired Frequently

gjmaster
Hello Team
I use websocket streaming for watch market in webpage. I use kite connect version 3 from past 4-5 months. But from last 5 days i fetch issue in access token. Access token is expired frequently, i need relogin again and again for get new access token. i think some one delete my access token because api key and access token details opened in my webpage. is it possible to access token not expire whole day ? Also i read all related post from this forum but i not get any helpful. please help me.
Thanks

  • rakeshr
    @gjmaster
    An access token is valid for one whole day. Unless you log out. Don't request for access token in every run. Once you receive an access token, use the same for subsequent runs. If your previous access token is still active then the system will give you back the same access token which is fine.
    Can you paste here complete traceback?
  • gjmaster
    I save access token in database then use access token in ticker.js but after some time when i refresh webpage then token automatically expired. then i delete a session by this url https://api.kite.trade/session/token?api_key=$api_key&access_token=$current_access_token";
    when i run up request then i will get reponse "Invalid Token or Api Key" means last token expired after that again login and regenerate access token but in just 5-10 minutes it expired.
    also please note that i fetch this problem from last 5 days. there is no problem before 5 days i used this webpage and ticker.js from last 6 months where no problem.
    also thx for your reply
  • gjmaster
    please reply and suggest me
  • rakeshr
    @gjmaster
    after some time when i refresh webpage then token automatically expired
    Are you talking about Kite Web page?
    Can you go to profile page in kite web and check all active session under Active session?
  • gjmaster
    no i develop market watch in my webpage through kite api.
  • gjmaster
    I clear all my session and after that try with new access token but i get error in websocket here is console log
    Firefox can’t establish a connection to the server at wss://ws.kite.trade/?api_key=something&access_token=something&uid=1537637266008
    403 forbidden Error
  • gjmaster
    if any official email or support number for kite api then please tell me.
  • sujith
    We haven't made any changes to the process recently. Are you sure you are not calling generate access token in between?
  • gjmaster
    yes. because i also not change any code which is running fine from last 4 months.
  • marketcommodity08
    I also get the same problem from last few days.I do the same things and save access token in database and fetch from there but it expires at any time as before it remains for wholeday.Please solve this issue as soon as possible.
  • marketcommodity08
    test_ws.js:114 WebSocket connection to 'wss://ws.kite.trade/?api_key=something&access_token=sometokenhere&uid=someidhere' failed: Error during WebSocket handshake: Unexpected response code: 403
  • sujith
    We had created access tokens for a couple of apps in the morning and it is still active.
    Are you sure, you are not logging out or calling generate session again?
  • marketcommodity08
    logged out means from where ?
  • marketcommodity08
    i dont say that always it expires frequently but some days it expires and i need to generate new access token
  • marketcommodity08
    please clearly write how access token will not expired and also where i need to always stay logged in?
  • gjmaster
    yes i am not calling again, now access token working only for 1 time. when refresh page with same access token its expired. (i use websocket ticker.js officially from github)
  • rediffpankaj_libra
    I just subscribed and was also facing the same issue. access token was working only once. However, today it seems to be working fine.
  • sujith
    You can know more here.
Sign In or Register to comment.