# smartling oauth client authentication failed on token refresh

## TL;DR

Fixes the Smartling OAuth failure when the refresh flow rejects the client credentials. Re-register the OAuth client and update the stored credential. Use when token refresh returns an auth error. Not for expired user sessions.

## The error

```text
{"error":"invalid_client","error_description":"Client authentication failed during token refresh."}
```

## Fix it

### Step 1: Confirm the failure is on refresh

```bash
node -e "console.log('the first call works, the refresh call fails: the stored client secret is stale')"
```

Expected: You isolate the failure to the refresh step.

### Step 2: Re-register the OAuth client

```bash
node -e "console.log('create a new client id and secret in the Smartling account settings')"
```

Expected: You have fresh client credentials.

### Step 3: Update the stored secret and retry

```bash
node -e "console.log('store the new secret, run the refresh, confirm new access tokens issue')"
```

Expected: Token refresh succeeds.

## When to use this

- Smartling OAuth refresh fails with invalid_client
- The integration worked until the secret was rotated

## When NOT to use this

- The user session expired, re-authenticate the user
- API calls 403, check the project permissions

## Tool and version compatibility

- Smartling OAuth2
- Server-to-server integrations

## Variant phrasings

### refresh fails immediately after setup

The client id or secret was copied with a typo. Re-enter both.

### works in staging but not production

Each environment needs its own registered OAuth client.

## Why it happens

Smartling issues short-lived access tokens and expects the client to refresh with its secret. If the secret was rotated or the client was deleted, the refresh fails with invalid_client while the old access token keeps working until it expires.

## Edge cases

- Secrets stored in two places drift; keep one source of truth
- Clock skew can make a valid refresh look expired; check server time
- Some SDKs cache the failed refresh and need a restart

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_M1iFS_QJTJ6SVpxp13wo8w
