Getting Handshake Error when subscribing to FyersOrderSocket [Python]

Digital Ocean:

  • Ubuntu 24.10
  • Python 3.12.7
  • fyers_apiv3 3.1.7

Same as above on Mac.

Error Snippet:
Error: Handshake status 403 Forbidden -±± {‘date’: ‘Thu, 08 May 2025 11:05:43 GMT’, ‘content-length’: ‘0’, ‘connection’: ‘keep-alive’, ‘cf-cache-status’: ‘DYNAMIC’, ‘set-cookie’: ‘__cf_bm=; path=/; expires=Thu, 08-May-25 11:35:43 GMT; domain=.fyers.in; HttpOnly; Secure; _cfuvid=-0.0.1.1-604800000; path=/; domain=.fyers.in; HttpOnly; Secure; SameSite=None’, ‘strict-transport-security’: ‘max-age=31536000; includeSubDomains; preload’, ‘x-content-type-options’: ‘nosniff’, ‘server’: ‘cloudflare’, ‘cf-ray’: ‘-SJC’} -±± b’’

Code-> Sample shared in Fyers Docs

I don’t see any resolutions on this topic.

DataSocket is working fine for me.

I have a limit order placed and I’m subscribing to listen to it’s status.

Please LMK if any additional information is required from my side.

Hey @106699983107133656502 ,

This error will comes when your accessToken is wrong , could you please generate a fresh access token and try .

@106699983107133656502 @WWhYB2qrsx
How to resolve this issue, the access token i am using is working well for receiving symboldata via websocket, but fails to connect order_ws. receiving same issue.

@mehboob.meghani.8o07kyb1 Not sure if you are still facing the issue, but it’s same as mine and SOLUTION is to prefix your app id along with it. Strange thing is access token works without app id for data websocket but not with order web socket.

Example:

APP_ID = “xxxxxxx-100”

ACCESS_TOKEN = “2347563244567878u6tyrfedssdffdsFE34642”

TOKEN_TO_PASS = APP_ID+“:”+ACCESS_TOKEN