Not getting accessToken

Manjunathan
Manjunathan edited March 2018 in Java client
Just switched to V3 after long time and renewed subscription. Used official java lib and ran Test script with my keys & token .

I am getting NullpointerException, Accesstoken is null.

Exception in thread "main" java.lang.NullPointerException
at com.zerodhatech.kiteconnect.kitehttp.KiteRequestHandler.postRequest(KiteRequestHandler.java:91)
at com.zerodhatech.kiteconnect.KiteConnect.generateSession(KiteConnect.java:182)
at Test.main(Test.java:45)

Please help me fix this.
  • sujith
    Are you sure you have set access token?
  • Manjunathan
    Probably didn't, just running the test as-is.

    Thought this step would do it automatically like the previous version(Rainmatter/kiteconnect)
    User user = kiteConnect.generateSession("yq6iaar2h77bsb", "zxyvm4k38ffyfmcqo");

    Please tell me how to do it (sorry if it is basic).
  • sujith
    @Manjunathan,
    I wouldn't run the sample files as is. If you run it as is then you will end up placing orders.
    Please go through documentation and understand the capabilities of Kite Connect APIs and then refer to the examples.
  • Manjunathan
    That as-is is only for the authentication.
    I wont execute other APIs. I have been using the old version for 3-4 months , so very familiar.

    The problem is - Auth part not working in sample file out-of-box( except putting my tokens and keys).
  • Manjunathan
    What modifications should I do so that I dont get the error.
    OR how to get/set accesstoken properly.
  • sujith
    If you are already using Kite Connect 2 then the flow remains same as earlier. Can you use the latest jar in the dist directory and make sure you set api_key, user_id, enable debug and paste the complete stack trace here?
  • Manjunathan
    Tried with a new setup , it worked .

    Thanks for the responses, please close the ticket.
This discussion has been closed.