# How to join a meeting with “Require authentication to join: Internal Users” security enabled using the SDK for web meetings?

**URL:** <https://devforum.zoom.us/t/how-to-join-a-meeting-with-require-authentication-to-join-internal-users-security-enabled-using-the-sdk-for-web-meetings/108499>\
**Category:** Web\
**Created:** [April 23, 2024, 2:19pm UTC](https://devforum.zoom.us/t/how-to-join-a-meeting-with-require-authentication-to-join-internal-users-security-enabled-using-the-sdk-for-web-meetings/108499 "2024-04-23T14:19:14Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![enya.santos](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/enya.santos/32/57243_2.png) [@enya.santos](https://devforum.zoom.us/u/enya.santos)\
**Post date:** [April 23, 2024, 2:19pm UTC](https://devforum.zoom.us/t/how-to-join-a-meeting-with-require-authentication-to-join-internal-users-security-enabled-using-the-sdk-for-web-meetings/108499/1 "2024-04-23T14:19:14Z")

</div>

I’m trying to integrate the SDK for web meetings to join meetings that have the “Require authentication to join: Internal Users” security option enabled. Could someone please guide me on how to resolve this issue? Appreciate any help in advance!

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [May 6, 2024, 2:19am UTC](https://devforum.zoom.us/t/how-to-join-a-meeting-with-require-authentication-to-join-internal-users-security-enabled-using-the-sdk-for-web-meetings/108499/2 "2024-05-06T02:19:07Z")

</div>

@enya.santos ,

If this setting is enabled, participants will need to use their ZAK token to authenticate themselves when joining the meeting.

---

<div class="post-metadata">

**Author:** ![enya.santos](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/enya.santos/32/57243_2.png) [@enya.santos](https://devforum.zoom.us/u/enya.santos)\
**Post date:** [May 7, 2024, 2:42pm UTC](https://devforum.zoom.us/t/how-to-join-a-meeting-with-require-authentication-to-join-internal-users-security-enabled-using-the-sdk-for-web-meetings/108499/3 "2024-05-07T14:42:33Z")

</div>

Hi, @chunsiong.zoom ,

How do I obtain the zak token for a user?

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [May 8, 2024, 3:53am UTC](https://devforum.zoom.us/t/how-to-join-a-meeting-with-require-authentication-to-join-internal-users-security-enabled-using-the-sdk-for-web-meetings/108499/4 "2024-05-08T03:53:33Z")

</div>

@enya.santos

If you are the admin / owner / developer associated with the user’s tenant, you can use server to server oauth app, use the access token to get the user’s ZAK token.

If you are not, then you will need to use OAuth App, prompt the user for permission to get their ZAK token, and use the access token to get the user’s ZAK token.

---

<div class="post-metadata">

**Author:** ![enya.santos](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/enya.santos/32/57243_2.png) [@enya.santos](https://devforum.zoom.us/u/enya.santos)\
**Post date:** [May 9, 2024, 2:04pm UTC](https://devforum.zoom.us/t/how-to-join-a-meeting-with-require-authentication-to-join-internal-users-security-enabled-using-the-sdk-for-web-meetings/108499/6 "2024-05-09T14:04:25Z")

</div>

@chunsiong.zoom ,

I’m encountering an issue despite passing the zak token. Here’s the error message I’m receiving:

![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/7/5/7546c213c562e339fffa4575241effc8e9f451a1.png)

```auto
errorCode: 3051
reason: "Require login"
type: "JOIN_MEETING_FAILED"
url: "https://applications.zoom.us/sdkhelper/auth?sdkToken={...}"

```

The meeting is configured with ‘Require authentication’.

Here’s the code snippet used to obtain the zak token:

```auto
await fetch(`https://api.zoom.us/v2/users/${userData.id}/token?type=tk`, {
      method: "GET",
      headers: {
        "Authorization": `Bearer ${access_token}`
      }
    });

```

And here’s the component view code:

```auto
const { default: ZoomMtgEmbedded } = await import('@zoom/meetingsdk/embedded');
const client = ZoomMtgEmbedded.createClient();

[...]

client.join({
    sdkKey,
    signature,
    meetingNumber: meetingNumber,
    password: passWord?.trim(),
    userName: `${fullName}`,
    userEmail: email,
    zak,
  })

```

Zoom Meeting SDK version used:

```auto
"meetingsdk^3.6.0": "link:@zoom/meetingsdk^3.6.0"

```

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [May 10, 2024, 4:14am UTC](https://devforum.zoom.us/t/how-to-join-a-meeting-with-require-authentication-to-join-internal-users-security-enabled-using-the-sdk-for-web-meetings/108499/7 "2024-05-10T04:14:14Z")

</div>

> [@enya.santos](#):
>
> ```auto
> await fetch(`https://api.zoom.us/v2/users/${userData.id}/token?type=tk`, {
> method: "GET",
> headers: {
> "Authorization": `Bearer ${access_token}`
> }
> });
> 
> ```

@enya.santos I believe this is client side. Did you managed to get a valid ZAK token, or did this throw a CORS error?

---

<div class="post-metadata">

**Author:** ![enya.santos](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/enya.santos/32/57243_2.png) [@enya.santos](https://devforum.zoom.us/u/enya.santos)\
**Post date:** [May 10, 2024, 2:51pm UTC](https://devforum.zoom.us/t/how-to-join-a-meeting-with-require-authentication-to-join-internal-users-security-enabled-using-the-sdk-for-web-meetings/108499/8 "2024-05-10T14:51:12Z")

</div>

@chunsiong.zoom,

I managed to generate a valid ZAK token successfully. Here’s an example: `eyJ0eXAiOiJKV1QiLCJzdiI6IjAwMDAwMSIsInptX3NrbSI6InptX28ybSIsImFsZyI6IkhTMjU2In0.eyJhdWQiOiJjbGllbnRzbSIsInVpZCI6IjB6d243c0h5UlBPZmRlMkJCb3VCclEiLCJpc3MiOiJ3ZWIiLCJzayI6IjAiLCJzdHkiOjEsIndjZCI6InVzMDYiLCJjbHQiOjAsImV4cCI6MTcxNTM1OTQ4MSwiaWF0IjoxNzE1MzUyMjgxLCJhaWQiOiJtUWFCdjlnX1RQS0hybHV3ZkFuMGV3IiwiY2lkIjoiIn0.4LQZchv3kDGVomTSjLqFirh9v5-OEk9_WfKIt6HJcEQ`

The route has been changed to ‘[https://api.zoom.us/v2/users/me/token?type=zak&ttl=7200](https://api.zoom.us/v2/users/me/token?type=zak&ttl=7200)’.

Additionally, please note that in the settings, the role is set to 0.

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [May 13, 2024, 4:41am UTC](https://devforum.zoom.us/t/how-to-join-a-meeting-with-require-authentication-to-join-internal-users-security-enabled-using-the-sdk-for-web-meetings/108499/9 "2024-05-13T04:41:10Z")

</div>

@enya.santos another thing to check is, did you use promises to ensure that the ZAK token is returned before calling client.join ?

---

<div class="post-metadata">

**Author:** ![enya.santos](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/enya.santos/32/57243_2.png) [@enya.santos](https://devforum.zoom.us/u/enya.santos)\
**Post date:** [May 14, 2024, 2:46pm UTC](https://devforum.zoom.us/t/how-to-join-a-meeting-with-require-authentication-to-join-internal-users-security-enabled-using-the-sdk-for-web-meetings/108499/10 "2024-05-14T14:46:27Z")

</div>

@chunsiong.zoom, yes, please check the full code below:

```auto
"use client"
import React, { useEffect, useRef } from 'react';
import { getSignature, getZakToken } from '../../domain/zoom';
import { EmbeddedClient, SuspensionViewType } from '@zoom/meetingsdk/embedded';
import { getCookie } from 'cookies-next';
import { isTokenExpired } from './utils/is-token-expired';
import { useRouter } from 'next/navigation';

export default function ZoomSDK({sdkKey, meetingNumber, password}: Props) {
  const router = useRouter();

  const zoomRef = useRef(null);
  const clientRef = useRef<typeof EmbeddedClient>()
  
  const role = 0;
  const zoomConfig = {
    sdkKey,
    meetingNumber: meetingNumber,
    password: password?.trim(),
    userName: "User",
    userEmail: "",
  }

  async function startMeeting(signature: any, zak?: string) {
    if (!zoomRef.current) return;
  
    try {
      const { default: ZoomMtgEmbedded } = await import('@zoom/meetingsdk/embedded');
      const client = ZoomMtgEmbedded.createClient();
      clientRef.current = client

      await client.init({
        debug: true,
        zoomAppRoot: zoomRef.current,
        language: 'en-US',
        customize: {
          video: {
            defaultViewType: 'galery' as SuspensionViewType,
            popper: {
              disableDraggable: true
            },
            isResizable: true,
          },
          chat: {
            popper: {
              disableDraggable: false,
              anchorReference: 'anchorEl',
              placement: 'right-end'
            }
          }
        }
      });
      console.log('[startMeeting] zak passing:', zak)
      await client.join({ signature, zak, ...zoomConfig });
      window.addEventListener('beforeunload', async () => {
        await client.leaveMeeting(); 
      });
    } catch (error) {
      console.error(error);
    }
  }

  async function setMeeting() {
    try {
      const zoomAccessToken = getCookie('zoom-access')
      const isExpired = isTokenExpired(zoomAccessToken);
      if(!isExpired && zoomAccessToken) {
        const zoomZakToken = await getZakToken(zoomAccessToken)
        return zoomZakToken?.token;
      } else {
        router.push('api/live/zoomauth')
      }      
    } catch(err) {
      console.error(err)
    }
  }
   
  useEffect(() => {
    const fetchMeeting = async () => {
      try {
        const zoomZakToken = await setMeeting()   
        const signatureResponse = await getSignature(meetingNumber, role)
        await startMeeting(signatureResponse.signature, zoomZakToken)
      } catch(err) {
        console.error(err)
      }
    } 

    fetchMeeting()

    return () => {
      window.removeEventListener('beforeunload', () => {})

      const cleanup = async () => {
        if(clientRef.current) await clientRef.current.leaveMeeting();
      };
      cleanup();
    };
  }, [])

  return (
    <div className="w-full">
      <div 
        ref={zoomRef}
        className="w-full h-full flex justify-center items-center" 
        id="meetingSDKElement" 
      ></div>
    </div>
  );
}

```

```auto
 "dependencies": {
    "@zoom/meetingsdk": "^3.6.1"
 }

```

I am trying to join as a participant in a meeting or webinar that requires authentication.

---

<div class="post-metadata">

**Author:** ![enya.santos](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/enya.santos/32/57243_2.png) [@enya.santos](https://devforum.zoom.us/u/enya.santos)\
**Post date:** [May 14, 2024, 10:25pm UTC](https://devforum.zoom.us/t/how-to-join-a-meeting-with-require-authentication-to-join-internal-users-security-enabled-using-the-sdk-for-web-meetings/108499/11 "2024-05-14T22:25:01Z")

</div>

@chunsiong.zoom , thank you for your attention. The issue has been resolved by removing the library with `npm remove @zoom/meetingsdk` and then reinstalling it with `npm install @zoom/meetingsdk`.

Thanks again for your help!

---

<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:** [June 14, 2024, 8:25am UTC](https://devforum.zoom.us/t/how-to-join-a-meeting-with-require-authentication-to-join-internal-users-security-enabled-using-the-sdk-for-web-meetings/108499/12 "2024-06-14T08:25:24Z")

</div>

Closed on June 14, 2024, 8:25am UTC

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