Getting status WaitingForActivation


I am requesting access token using c# language, my code and received json is as below. please check and update me regarding the same.


var nvc = new List<KeyValuePair<string, string>>();
nvc.Add(new KeyValuePair<string, string>(“grant_type”, “authorization_code”));
nvc.Add(new KeyValuePair<string, string>(“code”, received_code));
nvc.Add(new KeyValuePair<string, string>(“redirect_uri”, sitepath + “sxclient/connect_fa.aspx”));
var client = new HttpClient();
client.DefaultRequestHeaders.TryAddWithoutValidation(“Content-Type”, “application/json”);
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(“Basic”, utils.Base64Encode(app_client_id + “:” + app_client_secret));
var req = new HttpRequestMessage(HttpMethod.Post, “”) { Content = new FormUrlEncodedContent(nvc) };
var res = client.SendAsync(req);


Id = 11975, Status = WaitingForActivation, Method = “{null}”, Result = “{Not yet computed}”
AsyncState: null
CancellationPending: false
CreationOptions: None
Exception: null
Id: 11975
Result: null
Status: WaitingForActivation

Hi @nishitcaax,

Ewa from FreeAgent here again :wave: Based on the information you provided (though I’m no C# expert!), it looks like you might not be correctly handling an asynchronous task — the WaitingForActivation message you’re seeing, rather than being a response from our API, is in fact the status of your task. According to these docs it means that “the task is waiting to be activated and scheduled internally by the .NET Framework infrastructure”. It seems you might need to await the task to ensure it completes or access the response with client.SendAsync(req).Result.

Best wishes,


Thanks @Ewa_Lipinska,

I will look into it.