Token invalid or expired-Though all keys, Token and secretes are correctly provided

vishalnigam20
Using all correct keys api_key, api_secrete, user_id, and requestToken.
getting : Exception in thread "main" com.zerodhatech.kiteconnect.kitehttp.exceptions.TokenException
I have read all the relevant discussion but nothing helpful, I can send API keys, secrets separately.
This app newly created over the weekend, please help.
  • sujith
    Can you run in debug mode and paste the complete stacktrace here?
    Make sure to remove the app and user-specific details.
    Is it working the first time the access token is generated?
  • vishalnigam20
    @sujith thanks for responding, I just ran it. this specific line of log seems concerning.

    INFO: <-- 403 Forbidden https://api.kite.trade/session/token (135ms)

    Could you suggest possible reasons for this?

    Here’s a complete log.

    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO:
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: api_key=<I_have_it_hidden>&request_token=&checksum=4ad56d590923cc13460603602bd1ef472f51edd2890211400aa3977ec6f5b1a6
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: --> END POST (145-byte body)
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: <-- 403 Forbidden https://api.kite.trade/session/token (135ms)
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: Date: Mon, 15 Jun 2020 14:29:55 GMT
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: Content-Type: application/json
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: Transfer-Encoding: chunked
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: Connection: keep-alive
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: Set-Cookie: __cfduid=<I_have_it_hidden>; expires=Wed, 15-Jul-20 14:29:55 GMT; path=/; domain=.kite.trade; HttpOnly; SameSite=Lax
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: CF-Cache-Status: DYNAMIC
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: cf-request-id: 0359fc17780000d53b6c3a1200000001
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: Strict-Transport-Security: max-age=15552000; includeSubDomains
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: Server: cloudflare
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: CF-RAY: 5a3cfc6bfd0bd53b-DEL
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO:
    Jun 15, 2020 7:59:55 PM okhttp3.internal.platform.Platform log
    INFO: {"status":"error","message":"Token is invalid or has expired.","data":null,"error_type":"TokenException"}


  • sujith
    You can refer to this thread.
  • vishalnigam20
    vishalnigam20 edited June 2020
    @sujith thanks it worked!
This discussion has been closed.