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 AccountStore class.

...
 
// Create an AccountStore instance, where all instances will reference the same local database.
val accountStore = AccountStore(context)
 
// Get access to accounts Flow<List<Account>>. You can create a LiveData from this to reactively listen to database events.
val flowAccounts = accountStore.accountsFlow
// Retrieve accounts from the local database.
val accounts = accountStore.getAllAccounts
 
// Update account name
accountStore.updateAccountName(accounts[0], "newName")
 
// Invalidate account
accountStore.invalidateAccount(accounts[0])
 
// Delete account
accountStore.deleteAccount(accounts[0])
 
...

where:

  • accountStore.updateAccountName(accounts[0], "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.

Next steps

Generate offline TOTP