Hi
I want to generate token. I am consuming Nimbuspost Api. Below is the code i am tying
C#
var client = new RestClient("api.nimbuspost.com/v1/users/login");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
var body = @"{" + "\n" +
@" ""email"" : ""[email protected]""," + "\n" +
@" ""password"" : ""Temp234""" + "\n" +
@"}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);In response it is returning -
C#
{"status":true,"data":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NzE0NzIzNTksImp0aSI6Ilgwc3lCclRNYW43Z3BJN3NSYzNXNVBDbVNUTkF5M29FNDJEcENKVDFhR2s9IiwibmJmIjoxNjcxNDcyMzU5LCJleHAiOjE2NzE0ODMxNTksImRhdGEiOnsidXNlcl9pZCI6IjQ3MDYyIiwicGFyZW50X2lkIjoiMCJ9fQ.s4mOl1Oa24iiA1e-wTTsYGeLSBjARcDZWl1BkW10_Ej5aQzTGWXAlrBGjznEghQJa2rmZts6zy1igLPeGcAWUQ"}Thanks

Deepak TewatiaRank #142 · 16K reputationPosted Dec 19, 2022, 12:59 PM EST
Hi Ramco,
In response, data field contains the token that was generated. This token is a JWT (JSON Web Token) and is used to authenticate requests to the API.
Thanks
Ramco RamcoRank #462 · 5.4K reputationPosted Dec 19, 2022, 9:45 PM EST
Hi Deepak
How we can retreive it & save it in database.
Thanks