Check Status returns unauthorized

Hi I am writing .Net implementation for downloading the historical data for intraday summaries. When I am doing the Get request to see if extraction has been completed, the token seems to become invalid in while loop. I thought token is valid for 24 hrs. Could you please advise?


Thanks

Bhawana


public async Task CheckStatus(Uri locationUrl)

{

using var client = new HttpClient();

var statusCode = HttpStatusCode.Accepted;

var request = new HttpRequestMessage(HttpMethod.Get, locationUrl);

request.Headers.Add("Prefer", "respond-async");

request.Headers.Add("Authorization", "Token " + dssClient._token);

while (statusCode != HttpStatusCode.OK)

{

var response = await client.GetAsync(request.RequestUri, HttpCompletionOption.ResponseHeadersRead);

statusCode = response.StatusCode;

}

GetData(locationUrl.ToString());


}

Best Answer

  • bhawana.aggarwal
    bhawana.aggarwal Newcomer
    Answer ✓

    I think I missed this. It's fine w. please close the ticket


    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token",dssClient._token);

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.