# Issue with INSUFFICIENT\_PRIVILEGES Error When Ending Zoom Meeting Using Meeting SDK

**URL:** <https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187>\
**Category:** Web\
**Tags:** api, video-sdk\
**Created:** [July 23, 2024, 5:16am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187 "2024-07-23T05:16:46Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![ast.mm103](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@ast.mm103](https://devforum.zoom.us/u/ast.mm103)\
**Post date:** [July 23, 2024, 5:16am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/1 "2024-07-23T05:16:46Z")

</div>

I am currently developing a platform where students can book classes with coaches. Upon booking, a Zoom meeting is created using a main Zoom account. The flow is as follows:

1. **Class Booking:** A student books a class with a coach.
2. **Meeting Creation:** A Zoom meeting is created using a main Zoom account via the Zoom API.
3. **Meeting Start:** The meeting is started successfully on the frontend using the Zoom Meeting SDK.
4. **Meeting End:** When trying to end the meeting, an `INSUFFICIENT_PRIVILEGES` error is encountered.

**Implementation Details:**

**Frontend Code** :  
import React, { useEffect } from ‘react’;  
import { ZoomMtgEmbedded } from ‘@zoomus/websdk/embedded’;

const ZoomMeetingComponent = () =\> {  
const client = ZoomMtgEmbedded.createClient();

useEffect(() =\> {  
const meetConfig = {  
apiKey: ‘YOUR\_API\_KEY’,  
signature: ‘YOUR\_HOST\_SIGNATURE’, // Ensure this signature is generated with role 1  
meetingNumber: ‘YOUR\_MEETING\_NUMBER’,  
userName: ‘YOUR\_USER\_NAME’,  
passWord: ‘YOUR\_PASSWORD’,  
role: 1, // Ensure role is 1 for host  
leaveUrl: ‘YOUR\_LEAVE\_URL’,  
webEndpoint: ‘’  
};

```
client.init({
  debug: true,
  zoomAppRoot: document.getElementById('zoom-meeting-container'),
  language: 'en-US',
  assetPath: '',
  webEndpoint: meetConfig.webEndpoint,
});

client.join({
  apiKey: meetConfig.apiKey,
  signature: meetConfig.signature,
  meetingNumber: meetConfig.meetingNumber,
  password: meetConfig.passWord,
  userName: meetConfig.userName,
});

```

}, );

const endMeeting = () =\> {  
client.leaveMeeting({  
success: function () {  
console.log(‘Meeting ended successfully’);  
},  
error: function (error) {  
console.error(‘End meeting error’, error);  
}  
});  
};

return (

  
\<div id=“zoom-meeting-container” style={{ width: ‘100%’, height: ‘100vh’ }}\>
  
End Meeting  
  
);  
};

export default ZoomMeetingComponent;

**Backend Code for Generating Signature** :

async function generateZoomSignature (req, res) {  
const errors = validationResult(req);  
if (!errors.isEmpty()) {  
return res.status(400).send(sendResponse(1003, messages[1003], false, errors.errors));  
}  
try {  
const { meetingNumber, role } = req.body;  
const iat = Math.round((new Date().getTime() - 30000) / 1000);  
const exp = iat + 60 \* 60 \* 2  
const oHeader = { alg: ‘HS256’, typ: ‘JWT’ }

const oPayload = {  
sdkKey: config.zoomMeetingSdkClientId,  
mn: meetingNumber,  
role: role,  
iat: iat,  
exp: exp,  
tokenExp: exp  
}  
const sHeader = JSON.stringify(oHeader)  
const sPayload = JSON.stringify(oPayload)  
const sdkJWT = jwt.sign(sPayload, config.zoomMeetingSdkClientSecret, { header: oHeader });

return res.send(sendResponse(1097, messages[1101], true, { signature: sdkJWT } ));  
} catch (error) {  
console.error(‘Error handling Zoom webhook event:’, error);  
return res.status(500).send(sendResponse(1000, messages[1000], false));  
}  
}

**Issue:**  
I am able to start the meeting successfully with the Zoom Meeting SDK, but when attempting to end the meeting, I receive the following error:

_{type: ‘IMPROPER\_MEETING\_STATE’, reason: ‘closed’}_

**Context:**

- I have a main Zoom account from which all meetings are created.
- The coach, who is starting the meeting, is not the same user who created the meeting.
- I have also created a Zoom Meeting SDK account and use that account’s ID to start the meeting.

**Question:** Is this error occurring because the main host is a different user from the coach who is trying to end the meeting? If so, what is the recommended approach to resolve this issue? Can the host role be transferred programmatically, or is there another way to grant the necessary privileges to the coach?

Any guidance or suggestions on how to address this issue would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [July 24, 2024, 3:27am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/2 "2024-07-24T03:27:14Z")

</div>

@ast.mm103 you need to be host to end meeting.

To transfer host, the recipient needs to be licensed as well

---

<div class="post-metadata">

**Author:** ![ast.mm103](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@ast.mm103](https://devforum.zoom.us/u/ast.mm103)\
**Post date:** [July 24, 2024, 4:16am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/3 "2024-07-24T04:16:43Z")

</div>

@chunsiong.zoom  
Thank you for the response.  
How can I transfer the host role or ensure the recipient has the necessary license? My scenario involves coaches whose classes are booked by students. In this case, the coach should be the host, and the students should be participants.but the meetings are created by one main account which is not of any coach or student account.

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [July 24, 2024, 5:06am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/4 "2024-07-24T05:06:49Z")

</div>

@ast.mm103 get the recipient to sign up for license account?

---

<div class="post-metadata">

**Author:** ![ast.mm103](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@ast.mm103](https://devforum.zoom.us/u/ast.mm103)\
**Post date:** [July 24, 2024, 5:21am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/5 "2024-07-24T05:21:07Z")

</div>

@chunsiong.zoom  
No. i am not signing up the coach or student.

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [July 24, 2024, 5:26am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/6 "2024-07-24T05:26:23Z")

</div>

@ast.mm103 The meeting should be created under the licensed account, and the same licensed account should be the one starting the meeting.

---

<div class="post-metadata">

**Author:** ![ast.mm103](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@ast.mm103](https://devforum.zoom.us/u/ast.mm103)\
**Post date:** [July 24, 2024, 5:34am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/7 "2024-07-24T05:34:08Z")

</div>

@chunsiong.zoom  
I am creating the meeting with the main Zoom account, but the coach starts the meeting using the Zoom Meeting Web SDK in a React application. The coach is able to start the meeting successfully. However, when the coach clicks “Leave Meeting” or “End for All,” I receive the following error:

{type: ‘IMPROPER\_MEETING\_STATE’, reason: ‘closed’}

---

<div class="post-metadata">

**Author:** ![ast.mm103](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@ast.mm103](https://devforum.zoom.us/u/ast.mm103)\
**Post date:** [July 24, 2024, 5:36am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/8 "2024-07-24T05:36:52Z")

</div>

@chunsiong.zoom  
**Transfer Host Role Before Ending Meeting**

- Use the API to transfer the host role to the coach before they attempt to end the meeting.

const transferHostRole = async (meetingId, newHostId, accessToken) =\> {  
try {  
const response = await axios.patch(  
`https://api.zoom.us/v2/meetings/${meetingId}/status`,  
{ action: ‘update’, host\_id: newHostId },  
{ headers: { Authorization: `Bearer ${accessToken}` } }  
);  
console.log(‘Host role transferred successfully:’, response.data);  
} catch (error) {  
console.error(‘Error transferring host role:’, error.response ? error.response.data : error.message);  
}  
};

// Usage example before ending the meeting  
const endMeeting = async () =\> {  
await transferHostRole(‘YOUR\_MEETING\_ID’, ‘NEW\_HOST\_ID’, ‘YOUR\_ACCESS\_TOKEN’);  
client.leaveMeeting({  
success: function () {  
console.log(‘Meeting ended successfully’);  
},  
error: function (error) {  
console.error(‘End meeting error’, error);  
}  
});  
};

can i do this will it work ?

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [July 24, 2024, 5:53am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/9 "2024-07-24T05:53:11Z")

</div>

@ast.mm103

I’m not sure what you are trying to do with the code above. There is no such method to transfer host via the REST API.

Sharing license is not allowed anyway.

> **[Zoom Terms of Service](https://www.zoom.com/en/trust/terms/)**
>
> Find the latest Zoom Terms of Service that are applicable to any services, updates, enhancements, new features, and/or the addition of new Web properties.

---

<div class="post-metadata">

**Author:** ![ast.mm103](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@ast.mm103](https://devforum.zoom.us/u/ast.mm103)\
**Post date:** [July 24, 2024, 5:59am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/10 "2024-07-24T05:59:49Z")

</div>

@chunsiong.zoom

How can I fix this error:

```auto
{type: 'IMPROPER_MEETING_STATE', reason: 'closed'}

```

In my scenario, students join the meetings, and coaches, acting as hosts, start the meetings. Both students and coaches can start the meeting without any issues. The meetings are created using a licensed Zoom account, not the student or coach accounts, and neither students nor coaches are signed up on Zoom. However, when trying to end the meeting, I encounter the above error.

---

<div class="post-metadata">

**Author:** ![ast.mm103](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@ast.mm103](https://devforum.zoom.us/u/ast.mm103)\
**Post date:** [July 24, 2024, 6:02am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/11 "2024-07-24T06:02:35Z")

</div>

@chunsiong.zoom  
i was trying to do this with REST api to make coach as a host permission that now he is host and if he becomes the host then he will not get the above error.  
i am not sure will this works so i asked.

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [July 24, 2024, 6:15am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/12 "2024-07-24T06:15:43Z")

</div>

@ast.mm103

The proper way is to get the host to start the meeting. you can start the meeting by using the ZAK token to authenticate yourself as host.

Coaches should be licensed host.

The API which you have shared does not have the capabilities which you have mentioned.

---

<div class="post-metadata">

**Author:** ![ast.mm103](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@ast.mm103](https://devforum.zoom.us/u/ast.mm103)\
**Post date:** [July 24, 2024, 6:31am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/13 "2024-07-24T06:31:03Z")

</div>

@chunsiong.zoom  
i am using ZAKtoken to start the meeting and meeting is starting successfully before also without ZAK token from both either coach or student. but i got the issue when i end the meeting for a coach.

---

<div class="post-metadata">

**Author:** ![ast.mm103](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@ast.mm103](https://devforum.zoom.us/u/ast.mm103)\
**Post date:** [July 24, 2024, 6:31am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/14 "2024-07-24T06:31:44Z")

</div>

@chunsiong.zoom  
can u provide some refference ?

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [July 24, 2024, 6:37am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/15 "2024-07-24T06:37:29Z")

</div>

@ast.mm103 I’ll close this thread for now.

You will need a host to start the meeting and end the meeting. Anything else is not adhering to the terms and conditions under normal licensing.

There reference docs for update meeting is here

> **[Zoom Meeting API](https://developers.zoom.us/docs/api/rest/reference/zoom-api/methods/#operation/meetingStatus)**
>
> API Reference for /docs/api/rest/reference/zoom-api/methods

If you are build a solution which requires this use case, I would recommend you to sign up for an ISV account to support your scenario

> **[Zoom ISV Partner Program | Zoom](https://explore.zoom.us/en/isv/)**
>
> The Zoom ISV Developer Partner Program is designed to help builders integrate, embed, and take to market their application with Zoom Meetings and Video.

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [July 24, 2024, 6:37am UTC](https://devforum.zoom.us/t/issue-with-insufficient-privileges-error-when-ending-zoom-meeting-using-meeting-sdk/114187/16 "2024-07-24T06:37:37Z")

</div>

Closed on July 24, 2024, 6:37am UTC


