> ## Documentation Index
> Fetch the complete documentation index at: https://docs.daily.co/llms.txt
> Use this file to discover all available pages before exploring further.

# preAuth()

> Pre-authenticates a participant with the server before joining a call.

`preAuth(properties?)`

✗ Prebuilt✓ Custom

Optionally called before [`join()`](https://docs.daily.co/reference/daily-js/instance-methods/join) to pre-authenticate with the server. This unlocks information that would otherwise only be available after `join()`:

* [`accessState()`](https://docs.daily.co/reference/daily-js/instance-methods/access-state) — whether the participant needs to wait in a lobby
* [`room()`](https://docs.daily.co/reference/daily-js/instance-methods/room) — room and domain configuration

If the Daily bundle isn't already loaded, `preAuth()` will load it. It also will give access to the local participant through the `participant-updated` and `participants()` method. It will not initialize the local media. To access local devices before joining, use [`startCamera()`](https://docs.daily.co/reference/daily-js/instance-methods/start-camera).

> [!NOTE]
>
> `url` and `token` are locked in when `preAuth()` is called. Attempting to pass different values to `join()` will result in an error.

## Parameters

Takes the same properties as [`join()`](https://docs.daily.co/reference/daily-js/instance-methods/join). At minimum, provide:

**url** `string` *required*

The Daily room URL.

**token** `string`

Technically optional, but should be provided if a meeting token will be used for the call.

## Return value

Returns `Promise<{ access: DailyAccess }>`. `access` is `'unknown'` or `{ level: 'none' | 'lobby' | 'full' }`.

## Example

```javascript theme={null}
const { access } = await call.preAuth({ url: DAILY_ROOM_URL, token: MEETING_TOKEN });

if (access.level === 'lobby') {
  // Show a waiting room UI before joining
  showWaitingRoom();
} else {
  await call.join({ url: DAILY_ROOM_URL, token: MEETING_TOKEN });
}
```

## See also

> [card] Methods
>
> * [join()](https://docs.daily.co/reference/daily-js/instance-methods/join.md)
> * [accessState()](https://docs.daily.co/reference/daily-js/instance-methods/access-state.md)
> * [room()](https://docs.daily.co/reference/daily-js/instance-methods/room.md)
> * [startCamera()](https://docs.daily.co/reference/daily-js/instance-methods/start-camera.md)

> [card] Events
>
> * [access-state-updated](https://docs.daily.co/reference/daily-js/events/lifecycle-events.md#access-state-updated)
> * [participant-updated](https://docs.daily.co/reference/daily-js/events/participant-events.md#participant-updated)

> [card] REST API
>
> * [Create meeting token](https://docs.daily.co/reference/rest-api/meeting-tokens/create-meeting-token.md)

> [card] Guides
>
> * [Waiting room](https://docs.daily.co/docs/daily-js/guides/waiting-room.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.