/// <summary> /// Logs the user out /// </summary> /// <returns></returns> public async Task SignOut() { if (Helper.IsInternetAvailable()) { var result = await ApiWrapper <string> .Post(Api.Account.LogOut, null); } // Reset some properties SecureStorage.Remove(SecureStorageProperties.AccessToken); Preferences.Remove(PrivateSettings.AccessTokenExpiryDate); Preferences.Set(PrivateSettings.IsLoggedIn, false); }
private async Task <Tuple <SignInResponseDTO, string> > GetAuthenticationTokenAsync(string username, string password) { if (Helper.IsInternetAvailable()) { var request = new SignInRequestDTO { Username = username, Password = password, GrantType = "password", }; var result = await ApiWrapper <SignInResponseDTO> .Post(Lib.Api.Account.Token, request, false); return(result); } return(null); }
private async Task <Tuple <UserDTO, string> > GetUserInfoAsync() { if (Helper.IsInternetAvailable()) { var response = await ApiWrapper <UserDTO> .Get(Lib.Api.Account.UserInfo); if (response != null && response.Item1 != null && !response.Item1.Id.IsEmpty()) { var userDTO = response.Item1; return(Tuple.Create(userDTO, response.Item2)); } return(response); } return(null); }