# DELETE UNAUTHORIZED Participant using Web SDK

**URL:** <https://devforum.zoom.us/t/delete-unauthorized-participant-using-web-sdk/46280>\
**Category:** API and Webhooks\
**Created:** [March 23, 2021, 12:24am UTC](https://devforum.zoom.us/t/delete-unauthorized-participant-using-web-sdk/46280 "2021-03-23T00:24:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![digix.sameera](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/digix.sameera/32/23747_2.png) [@digix.sameera](https://devforum.zoom.us/u/digix.sameera)\
**Post date:** [March 23, 2021, 12:24am UTC](https://devforum.zoom.us/t/delete-unauthorized-participant-using-web-sdk/46280/1 "2021-03-23T00:24:24Z")

</div>

when user logged in to the meeting via on Web SDK. i want to check whether user is AUTHORIZED or NOT.

So i added this code. Here is my question

When user is NON-AUTHORIZED person . then automatically he or she should be delete by the system or Blacklist them , how can i accomplish this task using WEB SDK ?

```
  ZoomMtg.inMeetingServiceListener('onUserJoin', function (data) {

            console.log("ON USER JOIN");
            console.log('inMeetingServiceListener onUserJoin', data);

            var loggedUserId = data.userId;
            var loggedUserName = data.userName;

            $.ajax({
                type: "POST",
                url: "{{url('meeting/web/checkAuthorizedUser')}}",
                data: {
                    "loggedUserId": loggedUserId,
                    "loggedUserName": loggedUserName,
                    '_token': '{{csrf_token()}}',

                },
                dataType: 'json',

                success: function (data) {
                    alert(data);
                },

                error: function (data) {
                    console.log(data);
                }

            });
        });
```

---

<div class="post-metadata">

**Author:** ![alexmayo](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/alexmayo/32/27289_2.png) [@alexmayo](https://devforum.zoom.us/u/alexmayo)\
**Post date:** [March 23, 2021, 11:13am UTC](https://devforum.zoom.us/t/delete-unauthorized-participant-using-web-sdk/46280/2 "2021-03-23T11:13:08Z")

</div>

Hi @digix.sameera,

You can use the [`expel()`](https://marketplacefront.zoom.us/sdk/meeting/web/ZoomMtg.html#expel) method to remove a particular user from the meeting. Note that you must have kick privileges (Be the host or co-host) in order to do this.

```auto
ZoomMtg.expel({
    userId: 123456 //You can get the ID of the user from the onUserJoin event data.
});

```

Thanks,  
Alex

---

<div class="post-metadata">

**Author:** ![digix.sameera](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/digix.sameera/32/23747_2.png) [@digix.sameera](https://devforum.zoom.us/u/digix.sameera)\
**Post date:** [March 23, 2021, 2:13pm UTC](https://devforum.zoom.us/t/delete-unauthorized-participant-using-web-sdk/46280/3 "2021-03-23T14:13:41Z")

</div>

thanks @alexmayo

I run this code , then i got this console error message.

Please note  
I started this meeting as a HOST . then i reload page. and execute this code.

```
    {method: "expel", status: false, errorCode: 1, errorMessage: "Current user is neither host nor cohost", result: null}

```

errorCode: 1  
errorMessage: “Current user is neither host nor cohost”  
method: “expel”  
result: null  
status: false

---

<div class="post-metadata">

**Author:** ![alexmayo](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/alexmayo/32/27289_2.png) [@alexmayo](https://devforum.zoom.us/u/alexmayo)\
**Post date:** [March 23, 2021, 2:32pm UTC](https://devforum.zoom.us/t/delete-unauthorized-participant-using-web-sdk/46280/4 "2021-03-23T14:32:12Z")

</div>

Can you please post your `ZoomMtg.join()` code?

You also need to ensure that the `role` parameter is set to `1` when creating your signature.

Thanks,  
Alex

---

<div class="post-metadata">

**Author:** ![digix.sameera](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/digix.sameera/32/23747_2.png) [@digix.sameera](https://devforum.zoom.us/u/digix.sameera)\
**Post date:** [March 23, 2021, 3:02pm UTC](https://devforum.zoom.us/t/delete-unauthorized-participant-using-web-sdk/46280/5 "2021-03-23T15:02:03Z")

</div>

```
 function websdkready() {
    var testTool = window.testTool;
    // get meeting args from url
    var tmpArgs = testTool.parseQuery();
    console.log(tmpArgs)

    var meetingConfig = {
        apiKey: tmpArgs.apiKey,
        meetingNumber: tmpArgs.zoomMeetingId,
        userName: tmpArgs.userName,
        passWord: tmpArgs.meetingPassword,
        leaveUrl: "/index.html",
        role: parseInt(tmpArgs.meetingRole),
        userEmail: tmpArgs.userEmail,
        lang: tmpArgs.meetingLang,
        signature: tmpArgs.signature || "",
        china: tmpArgs.china === "1",
    };

    // a tool use debug mobile device
    if (testTool.isMobileDevice()) {
        vConsole = new VConsole();
    }

    if (meetingConfig.china)
        ZoomMtg.setZoomJSLib("https://jssdk.zoomus.cn/1.9.1/lib", "/av"); // china cdn option
        ZoomMtg.preLoadWasm();
        ZoomMtg.prepareJssdk();

    function beginJoin(signature) {
        ZoomMtg.init({
            leaveUrl: meetingConfig.leaveUrl,
            webEndpoint: meetingConfig.webEndpoint,
            disableInvite: true,
            disableCallOut: true,
            debug: true,
            isSupportAV: true,
            isSupportChat: false,
            meetingInfo: [],

            success: function () {
                ZoomMtg.i18n.load(meetingConfig.lang);
                ZoomMtg.i18n.reload(meetingConfig.lang);

                console.log(meetingConfig);

                ZoomMtg.join({
                    meetingNumber: meetingConfig.meetingNumber,
                    userName: meetingConfig.userName,
                    userEmail: meetingConfig.userEmail,
                    signature: signature,
                    apiKey: meetingConfig.apiKey,
                    passWord: meetingConfig.passWord,

                    success: function (res) {
                        console.log("join meeting success");
                        console.log(res);
                    },
                    error: function (res) {
                        console.log(res);
                    },
                });
            },
            error: function (res) {
                console.log(res);
            },
        });

        ZoomMtg.inMeetingServiceListener('onUserJoin', function (data) {
            console.log("ON USER JOIN");
            console.log('inMeetingServiceListener onUserJoin', data);
            ZoomMtg.expel({
                userId: 16779264
            });
        });

    }
    beginJoin(meetingConfig.signature);

};
```

---

<div class="post-metadata">

**Author:** ![alexmayo](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/alexmayo/32/27289_2.png) [@alexmayo](https://devforum.zoom.us/u/alexmayo)\
**Post date:** [March 23, 2021, 3:08pm UTC](https://devforum.zoom.us/t/delete-unauthorized-participant-using-web-sdk/46280/6 "2021-03-23T15:08:20Z")

</div>

@digix.sameera  
I notice that you are hard coding the value `16779264` however you should instead get this userID from the event `data` variable, and expel them if they are not allowed to be in the meeting.

---

<div class="post-metadata">

**Author:** ![digix.sameera](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/digix.sameera/32/23747_2.png) [@digix.sameera](https://devforum.zoom.us/u/digix.sameera)\
**Post date:** [March 23, 2021, 3:32pm UTC](https://devforum.zoom.us/t/delete-unauthorized-participant-using-web-sdk/46280/7 "2021-03-23T15:32:07Z")

</div>

No @alexmayo

I cannot find out “role” parameter accept for ZoomMtg.join({})

Please refer zoom join section  
[https://marketplace.zoom.us/docs/sdk/native-sdks/web/reference](https://marketplace.zoom.us/docs/sdk/native-sdks/web/reference)

---

<div class="post-metadata">

**Author:** ![alexmayo](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/alexmayo/32/27289_2.png) [@alexmayo](https://devforum.zoom.us/u/alexmayo)\
**Post date:** [March 23, 2021, 3:35pm UTC](https://devforum.zoom.us/t/delete-unauthorized-participant-using-web-sdk/46280/8 "2021-03-23T15:35:24Z")

</div>

My apologies! The role parameter should be configured when [generating your signature](https://marketplace.zoom.us/docs/sdk/native-sdks/web/build/signature).

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [March 23, 2021, 9:09pm UTC](https://devforum.zoom.us/t/delete-unauthorized-participant-using-web-sdk/46280/9 "2021-03-23T21:09:00Z")

</div>

Thanks for jumping in and helping @alexmayo!

Best,  
Will

---

<div class="post-metadata">

**Author:** ![digix.sameera](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/digix.sameera/32/23747_2.png) [@digix.sameera](https://devforum.zoom.us/u/digix.sameera)\
**Post date:** [March 23, 2021, 11:41pm UTC](https://devforum.zoom.us/t/delete-unauthorized-participant-using-web-sdk/46280/10 "2021-03-23T23:41:56Z")

</div>

No problem, Thanks @alexmayo

Here is the solution

```
   ZoomMtg.init({
            leaveUrl: meetingConfig.leaveUrl,
            webEndpoint: meetingConfig.webEndpoint,
            disableInvite: true,
            disableCallOut: true,
            debug: true,
            isSupportAV: true,
            isSupportChat: false,
            meetingInfo: [],

            success: function () {
                ZoomMtg.i18n.load(meetingConfig.lang);
                ZoomMtg.i18n.reload(meetingConfig.lang);

                console.log(meetingConfig);

                ZoomMtg.join({
                    meetingNumber: xxxxxxx
                    userName: xxxxxx
                    userEmail: xxxxxx
                    signature: xxxxxx,
                    apiKey: xxxxxx
                    passWord: x,xxxxxxx

                    success: function (res) {
                        console.log("join meeting success");
                        console.log(res);
                    },
                    error: function (res) {
                        console.log(res);
                    },
                });
            },
            error: function (res) {
                console.log(res);
            },
        });

  ZoomMtg.inMeetingServiceListener('onUserJoin', function (data) {
            console.log("ON USER JOIN");
            console.log('inMeetingServiceListener onUserJoin', data);

     if(condition){

            var userId = data.userId;
            ZoomMtg.expel({
                userId: userId
            });
        });
 }
```

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [March 24, 2021, 4:36pm UTC](https://devforum.zoom.us/t/delete-unauthorized-participant-using-web-sdk/46280/11 "2021-03-24T16:36:51Z")

</div>

Glad you were able to find a solution! 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [April 24, 2021, 2:36am UTC](https://devforum.zoom.us/t/delete-unauthorized-participant-using-web-sdk/46280/12 "2021-04-24T02:36:59Z")

</div>

Closed on April 24, 2021, 2:36am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
