Zoom SDK Web hide API key and Secret

Hi @tommy and @zhang_meifu

Thanks for pointing us for the right direction.

My first mistake was sending this POST request to the endpoint in text format It should be JSON request. :innocent:

Secondly, as @zhang_meifu mentioned in his reply, i had few issue with my index.js too. The issue was, reply from my javascript fetch request did not correctly passed to the ZoomMtg.join function. About hour of trial and error, i was able to fix my code finally.

Happy to say its working well now. Below is my index.js file. :slightly_smiling_face:

(function(){

    console.log('checkSystemRequirements');

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

 ZoomMtg.setZoomJSLib('https://dmogdx0jrul3u.cloudfront.net/1.4.2/lib', '/av');

ZoomMtg.preLoadWasm();

ZoomMtg.prepareJssdk();

var API_KEY = 'XXXXXXX';  

document.getElementById('join_meeting').addEventListener('click', function(e){

    e.preventDefault();

    if(!this.form.checkValidity()){

        alert("Enter Name and Meeting Number");

        return false;

    }

    var meetConfig = {

        apiKey: API_KEY,

        meetingNumber: parseInt(document.getElementById('meeting_number').value),

        userName: document.getElementById('display_name').value,

        passWord: "",

        leaveUrl: "https://zoom.us",

        role: 0

    };

    var endpoint = 'https://ipaa.herokuapp.com';

   var raw = JSON.stringify({"meetingNumber":meetConfig.meetingNumber,"role":1});

    fetch(`${endpoint}`, {

        method: 'POST',

        headers: {

            'Content-Type': 'application/json',

          },

        body: raw,

    })

.then(result => result.text())

.then(response => {

    console.log(response);

    var signature = JSON.parse(response);

    console.log(signature);

        ZoomMtg.init({

        leaveUrl: 'http://www.zoom.us',

        isSupportAV: true,

        success: function () {

            ZoomMtg.join(

                {

                    signature: signature.signature,               

                    meetingNumber: meetConfig.meetingNumber,

                    userName: meetConfig.userName,

                    apiKey: meetConfig.apiKey,

                    //userEmail: 'user@gmail.com',

                    passWord: meetConfig.passWord,

                    success: function(res){

                        $('#nav-tool').hide();

                        console.log('join meeting success');

                    },

                    error: function(res) {

                        console.log(res);

                    }

                }

            );

        },

        error: function(res) {

            console.log(res);

        }

    });

})

});

})();
1 Like