API Endpoint(s) and/or Zoom API Event(s) https://developers.zoom.us/docs/api/rest/reference/user/methods/#operation/userDelete
Description
We integrated Zoom API with our service to manage users from our system.
One of our customer encountered the following error when they trie to delete User using userDelete API.
The customer uses Okta provisioning to create account but as for delete they tried from our service.
We tried to set up Okta provisioning on our account but not able to reproduce the issue.
userDelete API worked as expected.
Error? Error code: 1107, Message: You can not disassociate a user with managed domain
How To Reproduce
We tried to set up Okta provisioning on our account but not able to reproduce the issue.
userDelete API worked as expected
To correctly delete a user from a managed domain, you need to specify the action=delete in the query parameters of your API request, not in the request body.
We use action=delete for “active” user and action= disassociate for “pending” and “inactive” user.
This is part of code calling Delete user
let user = {};
try {
user = await this.getUserById(userObj.getIdentifier());
} catch (err) {
return resolve({
operation: 'getUser',
cloudapp: constants.ZOOM_CONNECTION,
input: userObj.toJson(),
error: constants.errorCodes.NOT_FOUND_ERROR,
errorDetails: err.error.message,
});
}
// If user is active, need to call delete user API with delete as action
// If user is yet to accept invite, status will be pending and action needs to be sent as disassociate
let action = 'disassociate';
if (user.status === 'active') {
action = 'delete';
}
let queryParams = {
action: action,
};
const options = {
method: 'DELETE',
headers: {
Authorization: `Bearer ${this.authClient.getAccessToken()}`,
},
json: true,
};
const url = `${adminApiUrl}/users/${userObj.getIdentifier()}?${Object.entries(queryParams)
.map((e) => e.join('='))
.join('&')}`;
fetch(url, options)