Skip to main content
Package: com.coinbase.cdp.auth
Provides authentication tokens for CDP API requests. This interface defines the contract for supplying bearer tokens and optional wallet auth tokens to CDP clients. It allows for flexible token provisioning from various sources, including internal token generators, external authentication services, or custom token management systems. Implementations must provide:
  • A bearer token for the Authorization header
  • An optional wallet auth token for the X-Wallet-Auth header
Example implementation for a custom token source:
The SDK provides a default implementation via CdpTokenResponse that is returned by CdpTokenGenerator.

Method Details

bearerToken

Returns the bearer token for the Authorization header. This token is required for all CDP API requests and authenticates the client application. Returns: String - the bearer token (must not be null or blank)

walletAuthToken

Returns the optional wallet auth token for the X-Wallet-Auth header. This token is required for write operations (POST, PUT, DELETE) on account endpoints. It includes a hash of the request body and additional request metadata for enhanced security. Returns: Optional<String> - an Optional containing the wallet auth token, or empty if not available