Access Token

arjunender
Hi,

I am using .NET API

Getting error when requesting Access Token

I got request token when login to kite connect, the same passing to the below kite method

user = kite.RequestAccessToken(request token, secret key);

receiving this error
Error Message:
An unhandled exception of type 'KiteConnect.ParseException' occurred in KiteConnect.dll

respondData :
Count= 3
[System.Collections.Generic.KeyValuePair] :{[status,error]}



Thanks
  • tonystark
    Hi @arjunender,

    It seems there is some issue in your authentication process. Try wrapping your code inside a try catch block like this to get the error information:
    try
    {
    User user = kite.RequestAccessToken("", "");
    }
    catch (ParseException e)
    {
    Console.WriteLine(JsonSerialize(e.ResponseData));
    }
    Use JsonSerialize function from this sample code.
  • arjunender
    Hi @ajinasokan,

    ResponseData:
    Status : error
    Message : Invalid session credentials
    Error type : TokenException

    Thanks
  • sujith
    Hi @arjunender,
    Request token can be used only once and is valid only for a couple of minutes. An access token is valid for one whole day. Once you get access token store it in preference and use it for further use.
    Don't call RequestAccessToken every time you run the app.
  • arjunender
    arjunender edited August 2017
    Hi sujith,
    OK Got it

    How to login to kite.connect from .net
    I am using web browser but giving javascript errors
    thanks
  • sujith
    Hi @arjunender,
    It is mandatory by the exchange that a user has to manually login at least once a day. You will have to use a browser to log in.
    Can you give the error message or take a screenshot and paste a link?
  • arjunender
    Hi sujith,

    I am using .net WebBrowser and assigning kite connect url to the browser
    webBrowser1.Url = new Uri(kite.GetLoginURL())
    kite login page appears but with below error messages and not able to login


    thanks


  • tonystark
    Hi @arjunender,

    Unfortunately .Net WebBrowser component uses Internet Explorer 6 ActiveX component behind the scenes. This is a very old and deprecated tech. I suggest you open the link directly in your default browser like:
    Process.Start("https://www.google.com");
    or if you really want to use a browser component try better alternatives like: DotNetBrowser or CefSharp
  • arjunender
    Hi ajinasokan,

    Thanks for your suggestion.
    I will try these solutions
    Actually I don't want to copy Request Token or Access Token manually

    Thanks





This discussion has been closed.