public async Task <ClientAuthenticationResponse> AuthenticateClient(string _clientId, string _clientSecret, bool isLive = false) { var client = HttpConnection.CallClient(isLive); var bodyKeyValues = new List <KeyValuePair <string, string> >(); bodyKeyValues.Add(new KeyValuePair <string, string>("client_id", _clientId)); bodyKeyValues.Add(new KeyValuePair <string, string>("client_secret", _clientSecret)); bodyKeyValues.Add(new KeyValuePair <string, string>("grant_type", "client_credentials")); var formContent = new FormUrlEncodedContent(bodyKeyValues); var response = await client.PostAsync("/connect/token", formContent); var responseJson = await response.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject <ClientAuthenticationResponse>(responseJson)); }