> ## 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?)`

<Badge color="red">{"✗"} Prebuilt</Badge> <Badge color="green">{"✓"} Custom</Badge>

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

* [`accessState()`](/reference/daily-js/instance-methods/access-state) — whether the participant needs to wait in a lobby
* [`room()`](/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()`](/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.
</Note>

## Parameters

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

<ParamField body="url" type="string" required>
  The Daily room URL.
</ParamField>

<ParamField body="token" type="string">
  Technically optional, but should be provided if a meeting token will be used for the call.
</ParamField>

## 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

<CardGroup>
  <Card title="Methods" icon="code" iconType="solid">
    * [join()](/reference/daily-js/instance-methods/join)
    * [accessState()](/reference/daily-js/instance-methods/access-state)
    * [room()](/reference/daily-js/instance-methods/room)
    * [startCamera()](/reference/daily-js/instance-methods/start-camera)
  </Card>

  <Card title="Events" icon="bolt" iconType="solid">
    * [access-state-updated](/reference/daily-js/events/lifecycle-events#access-state-updated)
    * [participant-updated](/reference/daily-js/events/participant-events#participant-updated)
  </Card>

  <Card title="REST API" icon="server" iconType="solid">
    * [Create meeting token](/reference/rest-api/meeting-tokens/create-meeting-token)
  </Card>

  <Card title="Guides" icon="book-open" iconType="solid">
    * [Waiting room](/docs/daily-js/guides/waiting-room)
  </Card>
</CardGroup>
