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

# AuthConfig

> Authentication block for the OTLP exporter and safety-check API.

```ts theme={null}
interface AuthConfig {
  type: 'bearer' | 'apiKey' | 'basic'
  token?: string
  apiKey?: string
  username?: string
  password?: string
}
```

The `exporterAuth` field on [`TelemetryConfig`](/api-reference/types/telemetry-config)
takes an `AuthConfig`. The same credential is forwarded to the safety-check
API as `x-api-key`.

## Fields

<ParamField path="type" type="'bearer' | 'apiKey' | 'basic'" required>
  Which authentication scheme to use.
</ParamField>

<ParamField path="token" type="string">
  Required when `type: 'bearer'`. Sent as `Authorization: Bearer <token>`.
</ParamField>

<ParamField path="apiKey" type="string">
  Required when `type: 'apiKey'`. Sent as `x-api-key: <apiKey>`.
</ParamField>

<ParamField path="username" type="string">
  Required when `type: 'basic'`. Currently a no-op in the exporter (the
  `Authorization: Basic ...` header is commented out — track upstream).
</ParamField>

<ParamField path="password" type="string">
  Required when `type: 'basic'`. Same caveat as `username`.
</ParamField>

## Per-type validation

`ConfigValidator` enforces:

* `bearer` requires `token`.
* `apiKey` requires `apiKey`.
* `basic` requires both `username` and `password`.

Missing fields throw at `instrumentServer` time.

## Examples

### Bearer

```ts theme={null}
exporterAuth: {
  type: 'bearer',
  token: process.env.SEDATA_TOKEN!,
}
// → Authorization: Bearer <SEDATA_TOKEN>
```

### API key

```ts theme={null}
exporterAuth: {
  type: 'apiKey',
  apiKey: process.env.OTEL_API_KEY!,
}
// → x-api-key: <OTEL_API_KEY>
```

### Basic (validated, header not yet emitted)

```ts theme={null}
exporterAuth: {
  type: 'basic',
  username: 'collector',
  password: 'secret',
}
```

See [Authentication](/guides/authentication) for the full guide.
