Gateway busy when trying to get the access token

nknaveen328
I have been trying to get the access token for around 30 min but the gateway seems to busy. May i know when this will get resolved ?
  • nknaveen328
    @sujith can you help me with this ?
  • sujith
    @nknaveen328,
    Is this consistent or intermittent?
    Is this happening now?
    Since when are you observing this error? How are you logging in?
  • ankur0101
    @sujith , I am also facing the same problem.

    {
    "status": "error",
    "message": "Gateway is busy",
    "error_type": "NetworkException"
    }

    This is really annoying. I have paid for the API service and things are not working from your ends.
    Not so professional.
  • sujith
    @ankur0101,
    It would be helpful if you can post more details for which API call you are getting this and more details to reproduce.
  • ankur0101
    I am following these steps:

    1. I get the request token from the redirect URL that I have set:
    http://abcd.com/zerodha/redirect.php?status=success&request_token=xxxx

    2. I visit following site to calculate SHA-256 checksum (I know the way to do this in Python but first I need to get the proper visibility of the process)
    https://defuse.ca/checksums.htm#checksums
    Support api_key = aaa, request_token = xxx and api_secret = bbb, I enter

    aaaxxxbbb

    in the box of the site and get a checksum

    3. Put the data in postman:



  • ankur0101
    Sorry in above post, I forgot to update the request_url but after setting the correct one, I have started getting gateway is busy error.

    Need help.
  • ankur0101
    Still showing message Gateway is Busy.
    @sujith @Kailash Need help.
  • Kailash
    @ankur We're unable to reproduce this issue at our end. We've tried Paw and Postman. Are you setting the X-Kite-Version: 3 header?
  • Vivek
    @ankur0101 We have tried for our test apps and it works fine. Can you please pm your api_key so that we can check logs?
  • ankur0101
    @Kailash No since document does not specify to use it for given POST request.
    At given link https://kite.trade/docs/connect/v3/user/ under Authentication and token exchange nowhere it is written to mention kite version in header.

    @Vivek sending you my API key in PM
  • ankur0101
    @Kailash After adding X-Kite-Version: 3 in headers, it is working.

    One last question, what is the lifetime of request_token and access_token? Also what are public_token & refresh_token?

    Thanks
  • Kailash
    @ankur
    - `request_token`, 5 minutes
    - `access_token`, until invalidated using the API, or a master logout (from Kite web console), it'll last until the next morning 6 AM (every day flush is an exchange requirement).
    - `refresh_token` is a special long-standing token for read only requests issued selectively to exchange approved platforms
  • billapavi
    ZC4250 im getting same error for this client id please look into it.
  • sujith
    @billapavi,
    Are you sure your final login URL is like this ?
    You also need to make sure, you are sending all the headers as mentioned here.
  • cisk
    cisk edited January 2018
    @Kailash How to use refresh tokens? Please suggest if there's an example
  • sujith
    Hi @cisk,
    The refresh token is only meant for platforms, it is not meant for the individual users.
  • parmar_akshay
    parmar_akshay edited January 2018
    Hi i have written the following code and getting "gateway is busy error". Please help:
    import { KiteConnect } from "kiteconnect";
    import { getEnv } from "../lib/env";
    import { configurationFile } from "../lib/config";
    var kc = new KiteConnect(
    configurationFile[getEnv("NODE_ENV")].kiteConnect.apiKey
    );
    let getRequestTokenUrl =
    "https://kite.trade/connect/login?v=3&api_key=qkexi19nbjdwf9jm";

    export async function getAccessToken(url, payload) {
    kc
    .requestAccessToken(
    "ikFVQXXJwYkffmKmNECmK5lwbVbl7Cad",
    configurationFile[getEnv("NODE_ENV")].kiteConnect.apiKey.apiSecret
    )
    .then(function(response) {
    console.log(response);
    })
    .catch(function(err) {
    console.log(err.response);
    });
    }
  • sujith
    Hi @parmar_akshay,
    You seem to be using old kiteconnectjs. You need to the latest version of kiteconnectjs.
    Make sure you use new login URL.
  • parmar_akshay
    Thanks @sujith ..
    Any solution to create request_token automatically??
  • sujith
    @parmar_akshay,
    It is mandatory by the exchange that a trader has to log in manually at least once a day. Automating login is not recommended.
  • saivinaymohan
    saivinaymohan edited February 2018
    Gateway is busy
    After Switching to kite version 3.
    While we are feteching the access token we are getting the following exception
    <-- 502 Bad Gateway https://api.kite.trade/session/token (405ms)
    02-22 11:36:29.858 18519-19156/ D/OkHttp: Server: nginx
    02-22 11:36:29.858 18519-19156/ D/OkHttp: Date: Thu, 22 Feb 2018 06:06:28 GMT
    02-22 11:36:29.858 18519-19156/ D/OkHttp: Content-Type: application/json
    02-22 11:36:29.858 18519-19156/ D/OkHttp: Content-Length: 83
    02-22 11:36:29.858 18519-19156/ D/OkHttp: Connection: keep-alive
    02-22 11:36:29.861 18519-19156/ D/OkHttp: {"status": "error", "message": "Gateway is busy", "error_type": "NetworkException"}
  • sujith
    @saivinaymohan,
    Are you using javakiteconnect?
    Are you appending query param(v=3) in login URL?
  • saivinaymohan
    saivinaymohan edited February 2018
    no i am using rest api.
    and this is the url i am using https://kite.trade/connect/login?v=3&api_key=XXXXXXXXXX
  • sujith
    The request format for fetching access token has changed. Check out this example cURL.
  • saivinaymohan
    Hi @sujith
    I am using the same format. But I am getting the same error gateway is busy
    Please find the following request and response body
    Login Webview URL
    https://kite.trade/connect/login?v=3&api_key=XXXXXXXXXXXXXXXXXX


    For Getting Access Token
    Body Request:
    POST-https://api.kite.trade/session/token
    request_token=XXXXXXXXXXX&api_key=XXXXXXXXXXXXXX&X-Kite-Version=3&checksum=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    Response:
    502 Bad Gateway https://api.kite.trade/session/token (379ms)
    {
    "status": "error",
    "message": "Gateway is busy",
    "error_type": "NetworkException"
    }
  • sujith
    X-Kite-Version=3 is in the header and not in body. Please take a look at cURL carefully and do the same.
  • saivinaymohan
    saivinaymohan edited February 2018
    Ok
  • tambolishahid
    I am also facing the same error.

    I am using python library, when try to get access_token.

    Getting Gateway is Busy
  • sujith
    You need to send the Kite Connect version and authorization token in the header for all HTTP calls.
  • tambolishahid
    It is already there, i am using kite connect python version 3
  • sujith
    Is this intermittent or consistent issue?
    Can you let us know what are the params you are sending?
  • mohit77bansal
    I am getting the same error while using your latest KiteConnect3 python library.
Sign In or Register to comment.