Example #1
0
        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));
            }
        }
Example #2
0
 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);
 }