# BkperAuthConfig

Configuration options for the BkperAuth class.

### baseUrl?

```ts
optional baseUrl: string;
```

Override the authentication service base URL.

Most users don't need this. The default production URL works out of the box.

Use cases:
- Testing: Point to a mock authentication service for integration tests
- Development: Use a local mock server

#### Example

```typescript
// Testing with mock server
const auth = new BkperAuth({
  baseUrl: 'http://localhost:3000/mock-auth'
});
```

***

### getAdditionalAuthParams()?

```ts
optional getAdditionalAuthParams: () => Record<string, string>;
```

Provide additional parameters to send to the authentication service.

Useful for custom authentication flows or passing additional context
to your authentication implementation.

#### Returns

`Record`\<`string`, `string`\>

Record of key-value pairs to append to auth requests

#### Example

```typescript
// Custom authentication context
const auth = new BkperAuth({
  getAdditionalAuthParams: () => {
    const token = new URLSearchParams(location.search).get('custom-token');
    return token ? { customToken: token } : {};
  }
});
```

***

### onError()?

```ts
optional onError: (error) => void;
```

Called when an error occurs during authentication.

#### Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| `error` | `unknown` | The error that occurred |

#### Returns

`void`

***

### onLoginRequired()?

```ts
optional onLoginRequired: () => void;
```

Called when login is required (user needs to sign in).

#### Returns

`void`

***

### onLoginSuccess()?

```ts
optional onLoginSuccess: () => void;
```

Called when login succeeds (user is authenticated).

#### Returns

`void`

***

### onLogout()?

```ts
optional onLogout: () => void;
```

Called when the user logs out.

#### Returns

`void`

***

### onTokenRefresh()?

```ts
optional onTokenRefresh: (token) => void;
```

Called when the access token is refreshed.

#### Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| `token` | `string` | The new access token |

#### Returns

`void`
