"api_key" or "access_token" is invalid

adarsh
adarsh edited October 2023 in General
Hello! @sujith @rakeshr .

Kindly note that I purchased kiteconnect api for the following account- [email protected]
on 29th oct, Sunday but apparently the API is not working as it is not able to generate a valid access token.

Following is the error I am getting-

"api_key" or "access_token" is invalid

Connection closed: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))

The access token generated was valid always on my previous account with the same current code but now it is coming invalid everytime.

I have tried all sorts of suggestions on the forum to resolve this error but seems like kite connect api is not getting a valid access token although it is generated or refreshed successfully.

This is quite disappointing since earlier a payment failed for this API and now the api is not able to fetch a valid token while we are facing these repeated interruptions.
Request you to kindly rectify this issue as soon as possible. Thanks !!

Regards,
Aadarsh Bansal
Mob: 8077593119
  • sujith
    Your Kite Connect app seems fine. We don't have any issue at our end.
  • adarsh
    adarsh edited October 2023
    @sujith so what can we do to resolve it....

    kindly suggest because we are not able to connect ....the access token always comes invalid for unknown reason and this is with the same code we have been using ???

    Maybe you can grant ua a new app....since we already subscribed

    account- [email protected]
  • sujith
    Can you enable debug logs and post the complete stacktrace in private message?
  • adarsh
    Hello @sujith !! Kindly find the debug log as you asked for. Kindly note that this is the part of the log indicating the error. Please share if anything else is required. We have tried everything from our end and the issue is occuring. Before the same code was working perfectly. Kindly provide a solution to start our app as we are loosing on subscription period or initiate a refund. Thanks !!

    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /quote/ltp?i=NSE%3ANIFTY+50 HTTP/1.1" 403 None
    INFO:WDM:====== WebDriver manager ======
    Access token is not valid. Refreshing token...

    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "POST /session/token HTTP/1.1" 200 None
    Access token refreshed successfully.
    2023-10-30 23:10:00
    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
    Access token is not valid. Refreshing token...
    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /quote/ltp?i=NSE%3ANIFTY+50 HTTP/1.1" 403 None
  • sujith
    This is a partial stacktrace, can you share the Kite Connect request and response with header information?

    You can private message since it will have app and client specific tokens.
Sign In or Register to comment.