access_token request failed.

Amit2
Hi,

I am getting following error.
"That API call is not allowed for the authenticated user"

How can I fixed this?
my api_key is w85t1n0jr2sej32t.

Thanks
  • Vivek
    @Amit2 are you using DP2214? you can not use more than one user id for a given app and it can be changed in developers console. Currently DP2214 is the user enabled for the app.
  • Amit2
    Yes. I am using DP2214. I have only one id. What do u mean by I can not use more than one user id for a given app? U mean multiple request_token from same api_key?
  • Vivek
    @Amit2 Please try now, permissions wasn't enabled for your app and we have fixed it.
  • vishal4kumar
    Hi,
    I am also getting the same issue.

    {"status": "error", "message": "That API call is not allowed for the authenticated user", "error_type": "PermissionException"}

    It seems permission issue. Please give permission for my ID DV0672 api_key=g1kfwgobta6gug12

    thanks,
    vishal
  • Vivek
    @vishal4kumar Hi, publisher app cannot be used to access full api. Please create a app with type "Kite connect + Publisher" to get full api access.
  • vishal4kumar
    @vivek Thanks Vivek. Now I am able to login. I have 1 query-
    I fetched quote of YESBANK16MAYFUT and got following in response.

    {u'change_percent': -0.25, u'buy_quantity': 0.0, u'last_price': 915.35, u'ohlc': {u'high': 924.0, u'close': 915.6, u'open': 913.75, u'low': 910.75}, u'last_time': None, u'volume': 0, u'depth': {u'sell': [{u'price': -0.01, u'orders': 0, u'quantity': 0}, {u'price': -0.01, u'orders': 0, u'quantity': 0}, {u'price': -0.01, u'orders': 0, u'quantity': 0}, {u'price': -0.01, u'orders': 0, u'quantity': 0}, {u'price': -0.01, u'orders': 0, u'quantity': 0}], u'buy': [{u'price': -0.01, u'orders': 0, u'quantity': 0}, {u'price': -0.01, u'orders': 0, u'quantity': 0}, {u'price': -0.01, u'orders': 0, u'quantity': 0}, {u'price': -0.01, u'orders': 0, u'quantity': 0}, {u'price': -0.01, u'orders': 0, u'quantity': 0}]}, u'sell_quantity': 0.0, u'open_interest': 0.0, u'last_quantity': 700, u'change': -0.02}


    I can see that buy_quantity=0.0 and sell_quantity=0.0 in market depth. But on nseindia.com site its
    buy_quantity=2,89,800 and sell_quantity=4,38,200 for yesbank may fut.

    Are these 2 parameters supported in python kiteconnect client. If yes then why these are 0.0 in response

    Thanks,
    Vishal



  • Kailash
    Hi Vishal, it's most likely because data is flushed on weekends. When the market opens, the values should be realtime.
  • vishal4kumar
    @Kailash
    Hi Kailash,

    I am facing 2 issues-

    1. I am getting timeout in fetching the quote.

    File "C:\Users\vishi\Desktop\python\test.py", line 394, in
    data = kite.quote(exchange="NFO", tradingsymbol=nse_fut[i])
    File "build\bdist.win-amd64\egg\kiteconnect\__init__.py", line 370, in quote
    File "build\bdist.win-amd64\egg\kiteconnect\__init__.py", line 427, in _get
    File "build\bdist.win-amd64\egg\kiteconnect\__init__.py", line 483, in _request
    kiteconnect.exceptions.ClientNetworkException: Gateway timed out

    I am fetching the quote in loop every 2 sec.

    2. Due to 1, python client program stops and I need to logout and login again to get new request token because same request_tocken is not working when running python script again after timeout.

    ('Authentication failed', 'Invalid session credentials')
    Traceback (most recent call last):
    File "test.py", line 353, in
    user = kite.request_access_token(request_token="8jhvtl1aryc4j307m7pftaghkbk4xat3", secret="au2d27v5m3w1vre98m7591wu2k6jvpbe")
    File "build\bdist.win-amd64\egg\kiteconnect\__init__.py", line 210, in request_access_token
    File "build\bdist.win-amd64\egg\kiteconnect\__init__.py", line 431, in _post
    File "build\bdist.win-amd64\egg\kiteconnect\__init__.py", line 513, in _request
    kiteconnect.exceptions.TokenException: Invalid session credentials


    Can you please tell the solution for these 2 issues?

    Thanks,
    Vishal
  • Kailash
    @vishal4kumar Vishal, it's not ideal to poll the quote API, especially every 2 seconds. Please use the WebSocket for streaming data.

    Are you requesting the access_token multiple times? It should be done only once (and once an access_token is generated, the request_token you used becomes invalid).
  • vishal4kumar
    vishal4kumar edited May 2016
    @Kailash,

    Thanks for suggestion. Is websocket library for python client available for use?

    Thanks,
    Vishal
  • Kailash
    Hi @vishal4kumar,
    Not yet, but we'll be releasing it very soon. In the meanwhile, a Kite Connect user has released a Java library https://github.com/instruritesh/ZStreamingQuote
  • Vivek
    @vishal4kumar Python websocket client will be released on this weekend
  • akshay12489
    Hi I am getting same error like other member

    "That API call is not allowed for the authenticated user"

    Please check if it is not enabled for user id DA3085
  • Kailash
    What API call is returning this error? Also, your requests will only work when DA3085 logs in.
Sign In or Register to comment.