Can't subscribe to "Coinbase Direct Market Data" WSS channel

Hi there,
I’m having a tough time trying to subscribe to wss://

I cannot authenticate using the API key and secret that I have created.
What I’ve tried:
Proved that the API key and secret I’ve got are valid and enabled - they work to call a REST endpoint that requires authentication like GET .

Using the following code:

        const timestamp = ( / 1000).toFixed(0) + ''

        const p_apiKey = process.env.COINBASE_API_KEY;
        const p_secret = process.env.COINBASE_API_SECRET;

        const what = timestamp + 'GET' + '/users/self/verify'
        const key = Buffer.from(p_secret, 'base64')
        const hmac = crypto.createHmac('sha256', key)
        const signature = hmac.update(what).digest('base64')

        const subscribeData = {
            "type": "subscribe",
            "product_ids": [

            "channels": [
                    "name": "ticker",
                    "product_ids": [
            'key': p_apiKey,
            'signature': signature,
            'timestamp': timestamp


I get the following message back:

  type: 'error',
  message: 'Authentication Failed',
  reason: 'authentication required'

I noticed that on the basic https REST API, I had to use the API secret raw, rather than base64 encoded, and digest(‘hex’) instead of digest(‘base64’), but neither seems to work on the WSS.
I got this from the coinbase npm package, and looking into what it does.

I tried the coinbase-pro npm package, and that seems to require a passphrase.
When I created my API key, it never gave me a passphrase. A bit of googling suggests that only coinbase pro created API keys have a passphrase, so I went to, and it said it is deprecated.

Does anybody have any ideas on how to subscribe to this WSS feed?

You can not! Advanced Trade API keys does not work with Pro!

You need to use Advanced Trade websocket:


@bentaylor Thanks for the question! As previously mentioned, any API keys generated via Advanced Trade will not function on Coinbase Exchange.

However, you can still subscribe to wss:// (non-direct feed, which provides the same data) for any public channel that does not require authentication. You can find a list of the channels that require auth here. For a full list of channels (including non auth channels), take a look here.


I’ve been trying to use the code and description above to connect to wss:// and using the API Key from coinbase, that has no “secret”, but so far I’ve not found any example nor I’ve been able to subscribe to channels that require auth.

The documentation suggests it is possible to subscribe o auth channels … could someone provide some help ?

Thanks in advance