Skip to main content
Package: com.coinbase.cdp.auth
Response containing generated CDP authentication tokens. Always contains a bearer token. Optionally contains a wallet auth token if includeWalletAuthToken was set to true in the request. This class implements TokenProvider and can be used wherever token providers are accepted, such as in CDP client factory methods. Example usage:

Constructor Details

CdpTokenResponse

Validates the token response. Throws: [IllegalArgumentException](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/IllegalArgumentException.html "class or interface in java.lang") - if validation fails Parameters: bearerToken - String walletAuthToken - Optional<String>

Method Details

bearerOnly

Creates a response with only a bearer token. Parameters: bearerToken (String) - the bearer token Returns: CdpTokenResponse - the token response

withWalletAuth

Creates a response with both bearer and wallet auth tokens. Parameters: bearerToken (String) - the bearer token walletAuthToken (String) - the wallet auth token Returns: CdpTokenResponse - the token response

toString

Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. Specified by: [toString](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Record.html#toString\(\) "class or interface in java.lang") in class [Record](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Record.html "class or interface in java.lang") Returns: String - a string representation of this object

hashCode

Returns a hash code value for this object. The value is derived from the hash code of each of the record components. Specified by: [hashCode](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Record.html#hashCode\(\) "class or interface in java.lang") in class [Record](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Record.html "class or interface in java.lang") Returns: int - a hash code value for this object

equals

Indicates whether some other object is “equal to” this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object). Specified by: [equals](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Record.html#equals\(java.lang.Object\) "class or interface in java.lang") in class [Record](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Record.html "class or interface in java.lang") Parameters: o (Object) - the object with which to compare Returns: boolean - true if this object is the same as the o argument; false otherwise.

bearerToken

Returns the value of the bearerToken record component. Specified by: [bearerToken](/sdks/cdp-sdks-v2/java/com/coinbase/cdp/auth/TokenProvider) in interface [TokenProvider](/sdks/cdp-sdks-v2/java/com/coinbase/cdp/auth/TokenProvider "interface in com.coinbase.cdp.auth") Returns: String - the value of the bearerToken record component

walletAuthToken

Returns the value of the walletAuthToken record component. Specified by: [walletAuthToken](/sdks/cdp-sdks-v2/java/com/coinbase/cdp/auth/TokenProvider) in interface [TokenProvider](/sdks/cdp-sdks-v2/java/com/coinbase/cdp/auth/TokenProvider "interface in com.coinbase.cdp.auth") Returns: Optional<String> - the value of the walletAuthToken record component