Unauthorized to access websocket

We are developing a trading application using upstox. I try to access the websocket endpoint to get real time data but I am getting unauthorized to access websocket.

Error info: WebSocket error: Connection to ‘wss://api.upstox.com/v3/feed/market-data’ failed: Server sent invalid upgrade response: HTTP/1.1 401 Unauthorized Date: Wed, 09 Apr 2025 05:52:31 GMT Content-Type: application/json Transfer-Encoding: chunked Connection: keep-alive X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block Pragma: no-cache Strict-Transport-Security: max-age=0; includeSubDomains X-Frame-Options: DENY Cache-Control: must-revalidate,no-cache,no-store Vary: Origin Vary: Access-Control-Request-Method Vary: Access-Control-Request-Headers message: request failed cf-cache-status: DYNAMIC Set-Cookie: __cf_bm=s5Dksbt6odQ6i6MOPW4LND4BMpJvmsjN0_ZO2aNdeWg-1744177951-1.0.1.1-aDMKy8OQ_VJxpwiJDE9flNORbzeta0IDQAGabsIXhhDazC.6oIVkYePTWFfkwbEA; path=/; expires=Wed, 09-Apr-25 06:22:31 GMT; domain=.upstox.com; HttpOnly; Secure; SameSite=None Set-Cookie: _cfuvid=70Cx9OZyb3k9UV2KOFSXqvYW8iikaKc6jJoEazvZ0.I-1744177951481-0.0.1.1-604800000; path=/; domain=.upstox.com; HttpOnly; Secure; SameSite=None Server: cloudflare CF-RAY: 92d7bd244ea77ed0-MAA alt-svc: h3=“:443”; ma=86400

Please help me to enable websocket access to my application.

It looks like you’re getting an error due to an invalid access token. To resolve this, you’ll need to generate a fresh access token. The documentation here should guide you through the process: Authentication | Upstox Developer API

Thanks!