public async Task <UserProfile> GetUserProfileAsync(VSOToken token) { using (var client = new HttpClient()) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken); var response = await client.GetAsync(profileUrl); var content = await response.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject <UserProfile>(content)); } }
public async Task SaveAuthenticatedProfileAsync(string conversationId, string userId, VSOToken token, UserProfile profile) { TableOperation insertActivity = TableOperation.InsertOrReplace(new AuthenticationTableEntity { PartitionKey = conversationId, RowKey = userId, SerializedToken = JsonConvert.SerializeObject(token), SerializedProfile = JsonConvert.SerializeObject(profile), ExpiresAt = DateTime.UtcNow.AddSeconds(token.ExpiresIn) }); await table.ExecuteAsync(insertActivity); }