# Configuration

## Step 1: Create a Battle.net API client

1. Go to the [Battle.net Developer Portal](https://develop.battle.net/).
2. Log in with your Battle.net account and agree to the API Terms of Use.
3. Navigate to **API Access** > **Create Client**.
4. Fill in the client details:
    - **Client Name**: a name for your application.
    - **Redirect URIs**: if using Battle.net Login, add your site's OpenID Connect redirect URI: `https://example.com/openid-connect/battlenet`
    - **Service URL**: your site's homepage (optional).
5. Save the **Client ID** and **Client Secret**. The secret is only shown once.

## Step 2: Store the client secret securely

The client secret is stored via the [Key](https://www.drupal.org/project/key) module, which supports multiple storage backends.

1. Go to **Administration > Configuration > System > Keys** (`/admin/config/system/keys`).
2. Click **Add key**.
3. Configure:
    - **Key name**: `Battle.net Client Secret`
    - **Key type**: Authentication
    - **Key provider**: choose based on your environment:
        - **Configuration** — development only (stored in database).
        - **Environment variable** — recommended for production.
        - **File** — reads from a file outside the web root.

!!! warning "Production security"
    For production sites, always use the **Environment variable** or **File** provider. Never store API secrets in exportable configuration on a production site.

## Step 3: Configure the module

1. Go to **Administration > Configuration > Web services > World of Warcraft** (`/admin/config/services/wow`).
2. Enter your **Client ID**.
3. Select the **Client Secret** key you created in Step 2.
4. Choose your **Default region** (US, EU, KR, or TW).
5. Enable **Cache icons** (recommended — Blizzard's Terms of Use require caching media assets locally).
6. Click **Save configuration**.

## Step 4: Verify the connection

```
drush wow:test-connection
```

A successful response confirms your API credentials are working and data can be synced.

## Step 5: Sync your first data

```
drush wow:sync-realms --force
```

Check the [Dashboard](../operations/dashboard.md) at `/admin/reports/wow` to see sync status across all enabled submodules.
