Error at RequestAccessToken

mendse_a
mendse_a edited September 2017 in .Net API client
 private void Form1_Load(object sender, EventArgs e)
{
kite = new Kite(MyAPIKey, Debug: false);

wb1.Navigate(kite.GetLoginURL());

}

private void wb1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
string resurl= e.Url.AbsoluteUri;
if (resurl.Contains("127.0.0.1"))
{

string RequestToken= resurl.Split(new char[] { '&' })[1].Split(new char[] { '=' })[1];
User user = kite.RequestAccessToken(RequestToken, MySecret);

/* Error Occuring here as like this
An exception of type 'KiteConnect.ParseException' occurred in KiteConnect.dll but was not handled in user code
*/

string MyAccessToken = user.AccessToken;
string MyPublicToken = user.PublicToken;


}
}
Tagged:
  • tonystark
    tonystark edited September 2017
    Hi @mendse_a,

    Did you try to print request token? Probably this happens due to wrong data.

    You can also try to catch the exception and log response data in the console like this:
    try{
    User user = kite.RequestAccessToken(RequestToken, MySecret);
    }catch(ParseException e){
    Dictionary<string, dynamic> data = e.ResponseData;
    // check contents inside data
    }
    You can use this function to print it to debug console.
  • mendse_a
    mendse_a edited September 2017
    Thanks it works
Sign In or Register to comment.