public async Task <AccountSession> AuthenticateTokenAsync(string authCode) { HttpWebRequest webReq = HttpWebRequest.CreateHttp(Microsoft.OneDrive.Sdk.Authentication.OAuthConstants.MicrosoftAccountTokenServiceUrl); webReq.Method = "POST"; webReq.ContentType = "application/x-www-form-urlencoded"; using (StreamWriter sw = new StreamWriter(await webReq.GetRequestStreamAsync())) await sw.WriteAsync(oh.GetAuthorizationCodeRedemptionRequestBody(authCode, ClientId, null, null, ClientSecret)); using (HttpWebResponse webRes = (HttpWebResponse)webReq.GetResponse()) using (StreamReader sr = new StreamReader(webRes.GetResponseStream())) return(accountSession = new AccountSession(JsonConvert.DeserializeObject <IDictionary <string, string> >(await sr.ReadToEndAsync()))); }