Ejemplo n.º 1
0
 public static async Task<bool> VerifyAccount(UserAccountEntity userAccountEntity)
 {
     var theAuthClient = new HttpClient();
     var requestMsg = new HttpRequestMessage(new HttpMethod("GET"), EndPoints.ACCOUNT_VERIFY);
     requestMsg.Headers.Authorization = new AuthenticationHeaderValue("Bearer",
         userAccountEntity.GetAccessToken());
     HttpResponseMessage response;
     try
     {
         response = await theAuthClient.SendAsync(requestMsg);
     }
     catch (WebException)
     {
         return false;
     }
     if (response.StatusCode != HttpStatusCode.OK) return false;
     string responseContent = await response.Content.ReadAsStringAsync();
     userAccountEntity.SetUserEntity(UserEntity.Parse(responseContent, userAccountEntity));
     SaveUserCredentials(userAccountEntity);
     return true;
 }