# Config

Enum class representing different environments in Webex Connect.

The Config class is a configuration class used for the SDK. It includes properties such as appId, clientKey, environment, serverDomain, and [allowUnencryptedDatabaseFallback](https://developers.webexconnect.io/docs/config#allowunencrypteddatabasefallback).

**Syntax**: `class Config(appId: String, val clientKey: String, val environment: Environment = Environment.UK)`

## Constructors

| Public Constructor | Syntax                                                                                     |
| :----------------- | :----------------------------------------------------------------------------------------- |
| Config             | `constructor(appId: String, clientKey: String, environment: Environment = Environment.UK)` |

## Config

This method is used to initialize a Config instance with an appId, clientKey, and environment.

**Syntax**: `constructor(appId: String, clientKey: String, environment: Environment = Environment.UK)`

| Return Type | Property Name             | Description                                                                                                                                                                                                   |
| ----------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Boolean`   | `enableAuthTokenExchange` | Introduces Customer JWT authentication with optional token exchange. The SDK now supports secure authentication using a Customer JWT, with optional automatic exchange to a short-lived Connect access token. |

```kotlin
var enableAuthTokenExchange: Boolean
```

### `enableAuthTokenExchange`

Introduces Customer JWT authentication with optional token exchange. The SDK now supports secure authentication using a Customer JWT, with optional automatic exchange to a short-lived Connect access token.

* When `enableAuthTokenExchange = true`, the SDK automatically handles access-token storage, injection, refresh, and retry - exchanging the Customer JWT for a short-lived Connect access token and managing its full lifecycle on the caller's behalf.
* When `enableAuthTokenExchange = false` (the default), the SDK sends the Customer JWT directly with each request, preserving the legacy authentication behavior.

**Notes**

| Aspect         | Detail                                                                             |
| -------------- | ---------------------------------------------------------------------------------- |
| Default        | `false` - Customer JWT sent directly with each request; legacy behavior unchanged. |
| Properties key | `enableAuthTokenExchange=true` in `WebexConnectConfig.properties`.                 |
| Mutability     | Set at SDK initialization. Runtime changes have no effect.                         |

## Properties

[block:parameters]
{
  "data": {
    "h-0": "Return Type",
    "h-1": "Property Name",
    "h-2": "Description",
    "0-0": "String",
    "0-1": "[appId ](#appid) ",
    "0-2": "`var appId: String`  \nThe appId is generated while creating an app asset within Webex Connect.",
    "1-0": "String",
    "1-1": "[clientKey  ](#clientkey)",
    "1-2": "`val clientKey: String`  \nThe client key is generated while creating an app asset within Webex Connect.",
    "2-0": "void",
    "2-1": "[environment  ](#environment)",
    "2-2": "`val environment: Environment`  \nWebex Connect server environment",
    "3-0": "Boolean",
    "3-1": "[allowUnencryptedDatabaseFallback ](https://developers.webexconnect.io/docs/config#allowunencrypteddatabasefallback) ",
    "3-2": "`var allowUnencryptedDatabaseFallback: Boolean`  \nFlag indicating whether unencrypted database fallback is allowed.",
    "4-0": "String",
    "4-1": "[serverDomain  ](#serverdomain)",
    "4-2": "`var serverDomain: String?`  \nThe server domain for the application (to override the zero-rating domain)."
  },
  "cols": 3,
  "rows": 5,
  "align": [
    "left",
    "left",
    "left"
  ]
}
[/block]

### appId

Returns the appId.

**Syntax**: `var appId: String`

### clientKey

Returns the client key.

**Syntax**: `val clientKey: String`

### environment

Returns the Webex Connect server environment.

**Syntax**: `val environment: Environment`

### allowUnencryptedDatabaseFallback

Flag indicating whether unencrypted database fallback is allowed.

**Syntax**: `var allowUnencryptedDatabaseFallback: Boolean`

### serverDomain

The server domain for the application to override the zero-rating domain.

**Syntax**: `var serverDomain: String?`