Not able to join the meeting as host in web SDK 1.9.0

Description
I am trying to join a meeting through the participant URL and trying to assign role as Host by passing the role as 1 in the code as shown below

Code to join meeting -

 function StartMeeting() {
        var meetConfig = {
            apiKey: API_KEY,
            signature: API_Signature,
            meetingNumber: MeetingId,
            userName: Name,
            passWord: Password,
            //leaveUrl: "http://localhost:57898/Zoom/ZoomMain.html",
            leaveUrl: leavepath,
            role: Role,
            lang: culture
        };
        if (meetConfig.leaveUrl) {
            ZoomMtg.init({
                leaveUrl: meetConfig.leaveUrl,
                success: function () {
                    ZoomMtg.i18n.load(meetConfig.lang);
                    ZoomMtg.i18n.reload(meetConfig.lang);
                    ZoomMtg.reRender({ "lang": meetConfig.lang});
                    ZoomMtg.join(
                        {
                            meetingNumber: meetConfig.meetingNumber,
                            userName: meetConfig.userName,
                            signature: meetConfig.signature,
                            apiKey: meetConfig.apiKey,
                            passWord: meetConfig.passWord,
                            role: meetConfig.Role,
                            success: function (res) {
                                if (Action == "EndMeeting") {
                                    ZoomMtg.leaveMeeting({});
                                    console.log('Leave meeting success');
                                } else if (Action == "StartTestMeeting") {
                                    $("#nav-tool").hide();
                                    console.log('Join meeting success');
                                    HideJoinAudio();
                                } else {
                                    $("#nav-tool").hide();
                                    console.log('Join meeting success');
                                    debugger;

                                    //var obj = ZoomMtg.getInstance();
                                    //var inMeeting = obj.getInMeetingService();
                                    //inMeeting.makeHost(meetConfig.userName);
                                    HideJoinAudio();
                                    EnableButtonState();
                                }
                            },
                            error: function (res) {
                                console.log(res);
                            }
                        }
                    );
                },
                error: function (res) {
                    console.log(res);
                }
            });
        }

    }

Code to generate token - C#

static readonly char[] padding = { '=' };

        public static long ToTimestamp(DateTime value)
        {
            long epoch = (value.Ticks - 621355968000000000) / 10000;
            return epoch;
        }

public static string GenerateToken(string apiKey, string apiSecret, string meetingNumber, string ts, string role)
        {
            string message = String.Format("{0}{1}{2}{3}", apiKey, meetingNumber, ts, role);
            apiSecret = apiSecret ?? "";
            var encoding = new System.Text.ASCIIEncoding();
            byte[] keyByte = encoding.GetBytes(apiSecret);
            byte[] messageBytesTest = encoding.GetBytes(message);
            string msgHashPreHmac = System.Convert.ToBase64String(messageBytesTest);
            byte[] messageBytes = encoding.GetBytes(msgHashPreHmac);
            using (var hmacsha256 = new HMACSHA256(keyByte))
            {
                byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
                string msgHash = System.Convert.ToBase64String(hashmessage);
                string token = String.Format("{0}.{1}.{2}.{3}.{4}", apiKey, meetingNumber, ts, role, msgHash);
                var tokenBytes = System.Text.Encoding.UTF8.GetBytes(token);
                return System.Convert.ToBase64String(tokenBytes).TrimEnd(padding);
            }
        }

Error
Not able to Join As host.

Which Web Client SDK version?
1.9.0

Device (please complete the following information):

  • Browser: [ Chrome]
  • Browser Version -Version 90.0.4430.93 (Official Build) (64-bit)

Additional context
When I do break points on the code it does not go inside the success handler of the join function.

Hey @akshay.rao,

Thank you for reaching out to the Zoom Developer Forum. When this happens, do you see any errors in the Web SDK? What about in the browser console?

If so, please share the errors you’re seeing here.

Thanks,
Max

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