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

# CdpAuthenticationInterceptor

> Adds CDP request-bound credentials to generated Java SDK requests.

Package: [`com.coinbase.cdp.core`](/sdks/cdp-sdks-v2/java/com/coinbase/cdp/core/index)

```java theme={null}
public final class CdpAuthenticationInterceptor extends Object implements okhttp3.Interceptor
```

Adds CDP request-bound credentials to generated Java SDK requests.

The Fern-generated client attaches [`EndpointMetadata`](/sdks/cdp-sdks-v2/java/com/coinbase/cdp/core/EndpointMetadata "class in com.coinbase.cdp.core") to each request from the OpenAPI contract. This interceptor derives the bearer token for every request and adds wallet authentication only where that metadata requires `X-Wallet-Auth`. Consequently, a newly generated endpoint receives the appropriate request authentication without endpoint-specific handwritten SDK code.

## Constructor Details

### `CdpAuthenticationInterceptor`

```java theme={null}
public CdpAuthenticationInterceptor(String apiKeyId, String apiKeySecret, Optional<String> walletSecret)
```

**Parameters:**

`apiKeyId` - `String`

`apiKeySecret` - `String`

`walletSecret` - `Optional<String>`

## Method Details

### `intercept`

```java theme={null}
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException
```

**Throws:**

`[IOException](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html "class or interface in java.io")`

**Parameters:**

`chain` - `okhttp3.Interceptor.Chain`

**Returns:**

`okhttp3.Response`
