> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# verifyBearerToken

> Verify a Bearer token against the configured token.

[ref-validate]: /docs/server-sdks/reference/typescript/agents/configuration/auth-handler/validate

Verify a Bearer token against the configured token. Uses a constant-time
comparison to prevent timing attacks. Returns `false` immediately when Bearer
token auth is not configured.

<Note>
  Pass the raw token -- do **not** include the `"Bearer "` prefix. For full
  header-based validation (including prefix parsing), use
  [`validate()`][ref-validate].
</Note>

## **Parameters**

<ParamField path="token" type="string" required={true} toc={true}>
  The Bearer token string to verify, without the `"Bearer "` prefix.
</ParamField>

## **Returns**

`boolean` -- `true` if the token matches; `false` if it doesn't, or if Bearer
auth was not configured.

## **Example**

```typescript {8}
import { AuthHandler } from '@signalwire/sdk';

const auth = new AuthHandler({
  bearerToken: 'sk_live_abc123',
});

function authorize(header: string | undefined) {
  const token = header?.replace(/^Bearer\s+/i, '') ?? '';
  return auth.verifyBearerToken(token);
}
```