I have a Asp.net Web API project.
The project validates all the requests by receiving a parameter named sessionToken
http://myapi.com/api/applications/getApplications?sessionToken=xxx
However, i heard that is not safe to send the sensitive parameters via public urls, and i've seen an example where i can add the sessionToken
parameter inside the header of the HttpClient
request:
using (HttpClient client = new HttpClient())
{
client.BaseAddress = new Uri("http://myapi.com/");
client.DefaultRequestHeaders.Add("sessionToken", "xxx");
HttpResponseMessage response = await client.GetAsync("api/applications/getApplications");
string stringResponse = await response.Content.ReadAsStringAsync();
}
I am happy that now i can read the parameter without having to put it in the url.
Is it safe to send sensitive data via http request headers? (of course that they will be encrypted at least)