Facing Joining meeting timeout Signature is invalid. Issue

Hey,
I hope u r doing great. First of all, Thank you very much for providing wonderful video service. Let’s come on topic, Dear I have a facing a signature invalid issue when I join the meeting,
I am using Asp.net core with javascript. and used zoom CDN in our test app.
let’s share the code which I used.

front end code:

<!-- import #zmmtg-root css -->

<link type="text/css" rel="stylesheet" href="https://source.zoom.us/1.9.8/css/bootstrap.css" />
<link type="text/css" rel="stylesheet" href="https://source.zoom.us/1.9.8/css/react-select.css" />

<!-- added on import -->
<div id="zmmtg-root"></div>
<div id="aria-notify-area"></div>

<!-- added on meeting init -->
<div class="ReactModalPortal"></div>
<div class="ReactModalPortal"></div>
<div class="ReactModalPortal"></div>
<div class="ReactModalPortal"></div>
<div class="global-pop-up-box"></div>
<div class="sharer-controlbar-container sharer-controlbar-container--hidden"></div>


<!-- import ZoomMtg dependencies -->
<script src="https://source.zoom.us/1.9.8/lib/vendor/react.min.js"></script>
<script src="https://source.zoom.us/1.9.8/lib/vendor/react-dom.min.js"></script>
<script src="https://source.zoom.us/1.9.8/lib/vendor/redux.min.js"></script>
<script src="https://source.zoom.us/1.9.8/lib/vendor/redux-thunk.min.js"></script>
<script src="https://source.zoom.us/1.9.8/lib/vendor/lodash.min.js"></script>

<!-- import ZoomMtg -->
<script src="https://source.zoom.us/zoom-meeting-1.9.8.min.js"></script>



<script>
    var API_KEY = "L5CPxXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    var API_SECRET = "bvFXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    var meetingNumber = '7930889879';
    var userEmail = 'rizwan@gmail.com';
    var userName = 'Muhammad Rizwan';
    var password = "dGNDREJlL2tnbElJL0JRMU9Rcmd2UT09";

    var meetingConfig = {
        apiKey: API_KEY,
        webEndpoint:'',
        meetingNumber: meetingNumber,
        userName: userName,
        passWord: password,
        leaveUrl: "/index.html",
        role: 1,//parseInt(tmpArgs.role, 10),
        userEmail: userEmail,
        lang: "en-US",//tmpArgs.lang,
        signature: "",
        china: false,
    };

    console.log('checkSystemRequirements');
    console.log(JSON.stringify(ZoomMtg.checkSystemRequirements()));

    ZoomMtg.setZoomJSLib('https://source.zoom.us/1.9.8/lib', '/av');

    ZoomMtg.preLoadWasm();
    ZoomMtg.prepareJssdk();

    var signaturew = fetch('/home/GetSignature').then(data => data.json()).then(result => {
        console.log('GetSignature: ', result);

        meetingConfig.signature = result;
        meetingConfig.apiKey = API_KEY;

        ZoomMtg.init({
            leaveUrl: 'https://zoom.us',//meetingConfig.leaveUrl,
            isSupportAV: true,
            //webEndpoint: meetingConfig.webEndpoint,
            //disableCORP: !window.crossOriginIsolated, // default true
            // disablePreview: false, // default false
            success: function () {
                console.log(meetingConfig);
                console.log("signature", signaturew);
                // ZoomMtg.i18n.load(meetingConfig.lang);
                // ZoomMtg.i18n.reload(meetingConfig.lang);
                ZoomMtg.join({
                    signature: result,
                    meetingNumber: meetingConfig.meetingNumber,
                    userName: meetingConfig.userName,
                    apiKey: meetingConfig.apiKey,
                    userEmail: meetingConfig.userEmail,
                    passWord: meetingConfig.passWord,
                    //tk: registrantToken,
                    success: function (res) {
                        console.log("join meeting success");
                        console.log("get attendeelist");
                        ZoomMtg.getAttendeeslist({});
                        ZoomMtg.getCurrentUser({
                            success: function (res) {
                                console.log("success getCurrentUser", res.result.currentUser);
                            },
                        });
                    },
                    error: function (res) {
                        console.log('error join :: ', res);
                    },
                });
            },
            error: function (res) {
                console.log('error init :: ', res);
            },
        });
    });
    //var signature = ZoomMtg.generateSignature({
    //    meetingNumber: meetingNumber,
    //    apiKey: API_KEY,
    //    apiSecret: API_SECRET,
    //    role: 0,//meetingConfig.role,
    //    success: function (res) {
    //        console.log(res.result);
    //        meetingConfig.signature = res.result;
    //        meetingConfig.apiKey = API_KEY;
    //        //var joinUrl = "/Users/RIZWAN/Downloads/sample-app-web-master/sample-app-web-master/CDN/meeting.html?" + testTool.serialize(meetingConfig);
    //        //console.log(joinUrl);
    //        //window.open(joinUrl, "_blank");
    //    },
    //});


    const zoomMeeting = document.getElementById("zmmtg-root")

    function beginJoin(signature) {

        //ZoomMtg.init({
        //    leaveUrl: meetingConfig.leaveUrl,
        //    isSupportAV: true,
        //    success: function () {
        //        ZoomMtg.join({
        //            signature: signature,
        //            apiKey: meetingConfig.apiKey,
        //            meetingNumber: meetingConfig.meetingNumber,
        //            userName: meetingConfig.userName,
        //            passWord: meetingConfig.passWord ,
        //            error: function (res) {
        //               console.log('error join :: ', res);
        //           },
        //        })
        //    }
        //})

        //ZoomMtg.init({
        //    leaveUrl: 'https://zoom.us',//meetingConfig.leaveUrl,
        //    isSupportAV: true,
        //    //webEndpoint: meetingConfig.webEndpoint,
        //    //disableCORP: !window.crossOriginIsolated, // default true
        //    // disablePreview: false, // default false
        //    success: function () {
        //        console.log(meetingConfig);
        //        console.log("signature", signature);
        //       // ZoomMtg.i18n.load(meetingConfig.lang);
        //       // ZoomMtg.i18n.reload(meetingConfig.lang);
        //        setLogLevel('info')
        //        ZoomMtg.join({
        //            meetingNumber: meetingConfig.meetingNumber,
        //            userName: meetingConfig.userName,
        //            signature: meetingConfig.signature,
        //            apiKey: meetingConfig.apiKey,
        //            userEmail: meetingConfig.userEmail,
        //            passWord: meetingConfig.passWord,
        //            //tk: registrantToken,
        //            success: function (res) {
        //                console.log("join meeting success");
        //                console.log("get attendeelist");
        //                ZoomMtg.getAttendeeslist({});
        //                ZoomMtg.getCurrentUser({
        //                    success: function (res) {
        //                        console.log("success getCurrentUser", res.result.currentUser);
        //                    },
        //                });
        //            },
        //            error: function (res) {
        //                console.log('error join :: ', res);
        //            },
        //        });
        //    },
        //    error: function (res) {
        //        console.log('error init :: ',res);
        //    },
        //});

        ZoomMtg.inMeetingServiceListener('onUserJoin', function (data) {
            console.log('inMeetingServiceListener onUserJoin', data);
        });

        ZoomMtg.inMeetingServiceListener('onUserLeave', function (data) {
            console.log('inMeetingServiceListener onUserLeave', data);
        });

        ZoomMtg.inMeetingServiceListener('onUserIsInWaitingRoom', function (data) {
            console.log('inMeetingServiceListener onUserIsInWaitingRoom', data);
        });

        ZoomMtg.inMeetingServiceListener('onMeetingStatus', function (data) {
            console.log('inMeetingServiceListener onMeetingStatus', data);
        });
    }

    beginJoin(meetingConfig.signature);

</script>

And here is C# code:

public static long ToTimestamp(DateTime value)
        {
            long epoch = (value.Ticks - 621355968000000000) / 10000;
            return epoch;
        }
        public IActionResult GetSignature()
        {
            string apiKey = "L5CXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
            string apiSecret = "bvXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
            string meetingNumber = "7930889879";
            String ts = (ToTimestamp(DateTime.UtcNow.ToUniversalTime()) - 30000).ToString();
            string role = "1";
            string token = GenerateToken(apiKey, apiSecret, meetingNumber, ts, role);
            return Json(token);
        }
        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);
            }
        }

Hey @earner.rizwan,

Thank you for reaching out to the Zoom Developer Forum. I’m well, I hope you are too.

I’m glad to hear that you are enjoying Zoom!

Please send an email to developersupport@zoom.us with a link to this thread. In that ticket, please provide the signature that you’re using.

Thanks,
Max