public async Task <RequestResult> DeleteUser() { RequestResult result = new RequestResult(); try { if (cognitoUserSession != null && cognitoUserSession.IsValid()) { DeleteUserRequest dr = new DeleteUserRequest() { AccessToken = cognitoUserSession.AccessToken }; await provider.DeleteUserAsync(dr); result.Status = true; result.Message = "Deleted Successfully"; } else { //this.RefreshToken(username); result.Status = false; result.Message = "Not valid session"; } } catch (Exception ex) { result.Status = false; result.Message = ex.Message; } return(result); }
public async Task <Tuple <int, string> > DeleteUserAccountAsync(string username) { try { var deleteRequest = new DeleteUserRequest { AccessToken = UserAccessToken }; var deleteResult = await client.DeleteUserAsync(deleteRequest); if (deleteResult.HttpStatusCode == HttpStatusCode.OK) { return(Tuple.Create <int, string>(1, "User deleted successfully!")); } } catch (Exception e) { return(Tuple.Create <int, string>(0, e.Message)); } return(Tuple.Create <int, string>(-1, string.Format("Unable delete user: {0}!", username))); }