Need help in Login in Java

mailboxofrafiq
I need help in Java implementation of Kiteconnect login. Anybody has code snippet pls??
  • sujith
    You can check out sample files here.
    More examples are there in Examples.java file also.
  • ash
    ash edited January 2018
    @sujith that link is for old kiteconnect.
    as per kiteconnect 3:
    User user = kiteSdk.generateSession(request_token, apiSecret);

    this flow is not working.
    am getting TokenException while replacing old requestAccessToken with generateSession.

    also the documentation is not updated.(https://github.com/zerodhatech/javakiteconnect/tree/kite3)
    what to do?
  • mailboxofrafiq
    @ash.. are you developing a webapp or standalone java program??
  • sujith
    @ash,
    We will update documentation in this week. The examples are tested and updated.
    A request token is valid for only one time and it is valid for only a couple of minutes.
  • sujith
    Try running in debug mode to know what is the exact error message.
  • ash
    @sujith

    here's the error trace:
    com.zerodhatech.kiteconnect.kitehttp.exceptions.TokenException
    at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.dealWithException(KiteResponseHandler.java:48)
    at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.handle(KiteResponseHandler.java:20)
    at com.zerodhatech.kiteconnect.kitehttp.KiteRequestHandler.postRequest(KiteRequestHandler.java:61)
    at com.zerodhatech.kiteconnect.KiteConnect.renewAccessToken(KiteConnect.java:197)

    I'll suggest a shout out to devs once the documentation is ready.

    The whole flow is working fine with older version. Will switch once stable documentation is ready.
    There are no examples for kiteconnect 3 (login flow to begin with)
  • sujith
    You can enable debugging as shown in the example.
    Can you paste the final request URL and error message from the server?
  • sujith
    You need to use new login URL also. You can take a look at new API documentation here.
  • kenip
    Do you have a sample for Login Flow? If not then I am sorry to say that you have a pretty complex login flow. It should have been as simple as hitting the URL returned by "kiteConnect.getLoginUrl()" and getting the requestToken.
  • kenip
    @sujith I don't know the reasons behind the approach taken by you but creating 1 hr video, answering so many queries is just so unproductive (my personal feeling). Instead of all that if you had an api for login it would have been such a cakewalk. Or if you had an example which prompts the user using simple swing dialog or even command prompt to enter his secrety key, api key etc it would have been better.
  • sujith
    @kenip,
    It is mandatory by the exchange that a user has to log in at least once a day manually. I am afraid we can't provide APIs for login.
This discussion has been closed.