Websocket connection failed

I don’t understand why I am getting the first response as a success then the next 2 outputs are related to an authentication error. What am i missing here?

opened
received a message
[{"T":"success","msg":"connected"}]
received a message
[{"T":"error","code":402,"msg":"auth failed"}]
received a message
[{"T":"error","code":401,"msg":"not authenticated"}]

This is my code below

import config
import json
import websocket

def on_open(ws):
    print("opened")
    auth_data = {
        "action": "auth",
        "data": {"key": config.API_KEY, "secret": config.SECRET_KEY}
    }

    ws.send(json.dumps(auth_data))

# You can subscribe to the following: trades, quotes, bars, dailyBars, updatedBars, statuses and lulds
    listen_message = {"action": "subscribe", "trades": ["PLTR"], "quotes": ["PLTR"], "bars": ["PLTR"]}

    ws.send(json.dumps(listen_message))

def on_message(ws, message):
    print("received a message")
    print(message)

def on_close(ws):
    print("closed connection")


socket = "wss://stream.data.sandbox.alpaca.markets/v2/iex"

ws = websocket.WebSocketApp(socket, on_open=on_open, on_message=on_message, on_close=on_close)
ws.run_forever()

I seem to be running in to the same problem. Did you find a solution to your issue?