Sample code to generate Access token Public void GetAuthToken() { using (var reader = File.OpenText(@"D:\ConsumeEwayBillAPI\ewaybill_publickey.pem")) public_key = reader.ReadToEnd().Replace("-----BEGIN PUBLIC KEY-----","").Replace("-----END PUBLIC KEY-----","").Replace("\n",""); HttpWebRequest request = (HttpWebRequest)WebRequest.Create ("http://ewaybill2.nic.in/ewaybillapi/v1.02/Authenticate"); request.Method = "POST"; request.KeepAlive = true; request.AllowAutoRedirect = false; request.Accept = "*/*"; request.ContentType = "application/json"; request.Headers.Add("client-id", "test_clientid"); request.Headers.Add("client-secret", "test_client_secret"); request.Headers.Add("gstin", "testgstin"); string encPassword = Encrypt("testpwd", public_key); byte[] _aeskey = encdec.generateSecureKey(); //common.RandomString(32); // string straesKey = Convert.ToBase64String(_aeskey); string encAppKey = encdec.Encrypt(_aeskey, public_key); RequestPayload aRequestPayload = new RequestPayload(); aRequestPayload.action = "ACCESSTOKEN";
Sample code to generate Access token Public void GetAuthToken() { using (var reader = File.OpenText(@"D:\ConsumeEwayBillAPI\ewaybill_publickey.pem")) public_key = reader.ReadToEnd().Replace("-----BEGIN PUBLIC KEY-----","").Replace("-----END PUBLIC KEY-----","").Replace("\n",""); HttpWebRequest request = (HttpWebRequest)WebRequest.Create ("http://ewaybill2.nic.in/ewaybillapi/v1.02/Authenticate"); request.Method = "POST"; request.KeepAlive = true; request.AllowAutoRedirect = false; request.Accept = "*/*"; request.ContentType = "application/json"; request.Headers.Add("client-id", "test_clientid"); request.Headers.Add("client-secret", "test_client_secret"); request.Headers.Add("gstin", "testgstin"); string encPassword = Encrypt("testpwd", public_key); byte[] _aeskey = encdec.generateSecureKey(); //common.RandomString(32); // string straesKey = Convert.ToBase64String(_aeskey); string encAppKey = encdec.Encrypt(_aeskey, public_key); RequestPayload aRequestPayload = new RequestPayload(); aRequestPayload.action = "ACCESSTOKEN";
EWB%20API%2027Apr2018.docx