Meeting Web SDK + Server to Server App

Hello,

Thank you for replying.

I am not sure if that was the issue. Whether I had enabled that option to allow embedding or not at that time.

I seem to have made it working using my developer account.

I used one Server to Server App to Create the meeting using RES T API and One normal App for the front end.

The server to server app credentials were passed to get the authentication token (using account id, client id and client secret) and, to create the meeting, I used the access token (using the REST API). I was retrieving the ZAK token as well but meetings seem to work without it, but I am not sure right now.

Then after creating the meeting, I saved the meeting details into the database and redirected the user to the page having Web SDK CDN JavaScript and CSS files only.

On that page, based on whether the user was host or a normal user, I used role=0 or role=1 to generate the signature using normal SDK app’s credentials and passed those to join meeting.

use Firebase\JWT\JWT;

$signature = generateSignature($sdk_key, $sdk_secret, $meeting->meeting_id, $role);

    function generateSignature($sdk_key, $sdk_secret, $meeting_number, $role)
    {
        $iat = time();
        $exp = $iat + 60 * 60 * 2;
        $token_payload = [
            'appKey' => $sdk_key,
            'sdkKey' => $sdk_key,
            'mn' => $meeting_number,
            'role' => $role,
            'iat' => $iat,
            'exp' => $exp,
            'tokenExp' => $exp
        ];

        $jwt_token = JWT::encode($token_payload, $sdk_secret, 'HS256');
        return $jwt_token;
}

Then passed all the details to web sdk init and join function.

       let leave_url = '{{ $leave_url }}'
        let sdk_key = '{{ $sdk_key }}';
        let signature = '{{ $signature }}';
        let meeting_number = '{{ $meeting_number }}';
        let meeting_password = '{{ $meeting_password }}';

        //let zak_token = '{{-- $zak_token --}}';
        let user_name = '{{ $user_name }}';
        let email = '{{ $email }}';

        ZoomMtg.preLoadWasm();
        ZoomMtg.prepareWebSDK();

        ZoomMtg.init({
            leaveUrl: leave_url,
            success: (success) => {
                ZoomMtg.join({
                    sdkKey: sdk_key,
                    signature: signature, // 1
                    meetingNumber: meeting_number,
                    passWord: meeting_password,
                    userName: user_name,
                    //zak: zak_token, // the host's zak token
                    disableRecord: false,
                    /* videoDrag: true,
                    sharingMode: 'both',*/
                    success: (success) => {
                        console.log(success)
                    },
                    error: (error) => {
                        console.log('Join error');
                        console.log(error)
                    }
                })
            },
            error: (error) => {
                console.log(error)
            }
        })

I am not sure whether this is the right way or not but it seems to work for developer account at least.

Thank you.