I’m in the process of writing some code to, via the DUO API, delete users that have left my university and no longer qualify for our license. In looking over the API, it seems that the logic will be something like this:
For every user_id to be deleted
For every phone assigned to the user
call /admin/v1/phones to find out if there are multiple users for the phone
if user_id is the only user of the phone
call /admin/v1/users/[user_id]/phones/[phone_id] to disassociate the phone from the user
*** repeat above For loop for any hardware tokens
I was hoping that the delete user API would take care of all of this like the management console does, and also put the user into the trash bin, but alas it doesn’t. Everything needs to be done in separate tasks.
Am I on the right track?