☰
Login
Signup
Home
›
Mobile and Desktop apps
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
13.9K
All Categories
0
Incidents
156
Node JS client
40
Go client
793
.Net API client
380
Kite Publisher
537
.Net / VBA / Excel (3rd party)
459
Algorithms and Strategies
999
Java client
1.1K
API clients
404
PHP client
4K
Python client
348
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.3K
General
In this Discussion
August 2016
yar.srikanth
August 2016
Kailash
Invalid checksum
yar.srikanth
August 2016
in
Mobile and Desktop apps
Hi im getting below error
{"status": "error", "message": "Invalid checksum", "error_type": "TokenException"}
below is my code in C#
Byte[] byteArray = Encoding.UTF8.GetBytes(api_key + request_token + api_secret);
SHA256 myHash = SHA256Managed.Create();
Byte[] hashedByteArray = myHash. ComputeHash(byteArray);
string checksumString = Encoding.UTF8.GetString(hashedByteArray);
var httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("
https://api.kite.trade/
");
StringContent data = new StringContent("api_key="+ api_key+ "&request_token="+ request_token + "&checksum="+ checksumString);
var responseMessage = httpClient.PostAsync("session/token", data).Result;
var result = responseMessage.Content.ReadAsStringAsync().Result;
my api key is 4xzr5o38b5pv8e4n
Kailash
August 2016
There's something wrong with the SHA-256 hash you are creating then.
Generate a request token, and PM me the request_token and the hash you are generating. I'll check if your hash matches the right one.
yar.srikanth
August 2016
yea i fixed it. i made this change
Byte[] byteArray = Encoding.UTF8.GetBytes(api_key + request_token + api_secret);
SHA256 myHash = SHA256Managed.Create();
Byte[] hashedByteArray = myHash.ComputeHash(byteArray);
StringBuilder Sb = new StringBuilder();
foreach (Byte b in hashedByteArray)
Sb.Append(b.ToString("x2"));
//string checksumString = Encoding.UTF8.GetString(hashedByteArray);
string checksumString = Sb.ToString();
This discussion has been closed.
Generate a request token, and PM me the request_token and the hash you are generating. I'll check if your hash matches the right one.
Byte[] byteArray = Encoding.UTF8.GetBytes(api_key + request_token + api_secret);
SHA256 myHash = SHA256Managed.Create();
Byte[] hashedByteArray = myHash.ComputeHash(byteArray);
StringBuilder Sb = new StringBuilder();
foreach (Byte b in hashedByteArray)
Sb.Append(b.ToString("x2"));
//string checksumString = Encoding.UTF8.GetString(hashedByteArray);
string checksumString = Sb.ToString();