Skip to main content

Manage enrolled accounts

This topic explains how to manage the accounts enrolled in the SecureAuth Mobile SDK.

In this part of the workflow, you will set up access to accounts so you can update, invalidate, or delete an account.

Use the following code to create the AccountsViewModel class.

// Create an AccountsViewModel to use in your accounts view controller
let accountsViewModel = AccountsViewModel(secureAuth.accountStore)

// Load accounts to viewModel

// Return accounts array

// Delete accounts, pass an account array with accounts that need to be deleted
	.subscribe(onCompleted: { 
		// Update your UI once accounts have been deleted
	.disposed(by: disposeBag)

// Retrieve account from specific index
var account = accountsViewModel.accountAt(Int)

// Update account name = "newName" // Replace newName with the new name for the account

// Invalidate account
// Remember to call saveAccounts after any account changes have been made
    .subscribe(onError: { error in
		// Handle error appropriately
	.disposed(by: disposeBag)


  • = "newName"

    Replace "newName" with the new name for the account.

  • Update account: Account names don't have to be unique because each account has a unique enrollment code as the identifier.

  • Invalidate account: An invalidated account must be enrolled again to reinstate it.

  • Delete account: The account is deleted from the device. The end user enrollment associated with the deleted device will exist in Active Directory, Azure AD, etc., but the device will no longer receive push notifications unless the end user enrolls again.