BinaryOptionsTools-v2 icon indicating copy to clipboard operation
BinaryOptionsTools-v2 copied to clipboard

auth errors with valid ssid

Open potionsnotusedlol opened this issue 9 months ago • 8 comments

Description

Authorization algorithm not working properly.

Reproduction

  1. Copy basic code from candles tutorial
  2. Auth does not pass

Expected Behavior

    try:
        success = await api.connect()

        if success is True:
            print("connection + auth successful")
        else:
            print("connection returned false -> auth problem") # this is what is being printed
    except Exception as e:
        print(f"connection / auth failed immediately: {type(e).__name__}: {e}")

Should pass successfully

Context

  • macOS Tahoe 26.4:
  • Python 3.14.3_1:
  • binaryoptionstoolsv2 0.2.8:
  • pip

Evidence

Code Sample

    ssid = config.SSID.get_secret_value()
    api = PocketOptionAsync(ssid)
    
    try:
        success = await api.connect()

        if success is True:
            print("connection + auth successful")
        else:
            print("connection returned false -> auth problem")
    except Exception as e:
        print(f"connection / auth failed immediately: {type(e).__name__}: {e}")
        

Error Logs

connection returned false -> auth problem

Additional Information

The login/subscription algorithm might be updated.

potionsnotusedlol avatar Mar 03 '26 14:03 potionsnotusedlol

Hello! @Rick-29, @sixtysixx and me are going to check what is going, thanks for the patience!

theshadow76 avatar Mar 03 '26 17:03 theshadow76

Seems to work with get_candles example.

Please use the example to adjust your code(base) accordingly, the SSID should start with 42["auth", as far as I can tell, this is either an SSID issue or an code(base) issue. If you can provide any more sample code, that could assist further.

Closing until more detail is provided.

sixtysixx avatar Mar 03 '26 18:03 sixtysixx

Thank you for your time, I have copied and pasted the the full get_candles code and enabled the logs. There is an infinite loop of websocket reconnections, to which I have no explanation. Here's the logs:

2026-03-04T00:09:35.499144Z DEBUG Ssid: Parsed Real SSID. UID: [hidden], IP: 46.21.81.xxx, UA: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36 Edg/145.
2026-03-04T00:09:35.500922Z DEBUG Runner: Starting connection cycle...
2026-03-04T00:09:35.501847Z DEBUG PocketUtils: Trying geo provider: https://i.pn/json/46.21.81.[xxx]
2026-03-04T00:09:35.503020Z DEBUG reqwest::connect: starting new connection: https://i.pn/
2026-03-04T00:09:35.517560Z DEBUG hyper_util::client::legacy::connect::http: connecting to 134.119.216.174:443
2026-03-04T00:09:35.519035Z DEBUG hyper_util::client::legacy::connect::http: connected to 134.119.216.174:443
2026-03-04T00:09:35.781622Z DEBUG hyper_util::client::legacy::pool: pooling idle connection for ("https", i.pn)
2026-03-04T00:09:35.781626Z DEBUG PocketUtils: Found location via https://i.pn/json/46.21.81.[xxx]: 37.308, 49.5821
2026-03-04T00:09:35.784681Z  INFO PocketConnectThread: Connecting to PocketOption at wss://api-msk.po.market/socket.io/?EIO=4&transport=websocket
2026-03-04T00:09:35.791034Z DEBUG PocketConnect: Connecting to api-msk.po.market with UA: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36 Edg/145. and Origin: https://pocketoption.com
2026-03-04T00:09:36.101296Z DEBUG tungstenite::handshake::client: Client handshake done.
2026-03-04T00:09:36.102941Z DEBUG PocketConnect: Successfully connected to PocketOption
2026-03-04T00:09:36.104639Z DEBUG Runner: Connection successful.
2026-03-04T00:09:36.104862Z DEBUG Runner: Executing on_connect callback.
2026-03-04T00:09:36.105378Z DEBUG Router: Routing message: Text(Utf8Bytes(b"0{\"sid\":\"[hidden]\",\"upgrades\":[],\"pingInterval\":25000,\"pingTimeout\":20000,\"maxPayload\":1000000}"))
2026-03-04T00:09:36.105616Z DEBUG Lightweight: Received: Text(Utf8Bytes(b"0{\"sid\":\"[hidden]\",\"upgrades\":[],\"pingInterval\":25000,\"pingTimeout\":20000,\"maxPayload\":1000000}"))
2026-03-04T00:09:36.105950Z DEBUG LightweightModule: Routing rule for KeepAliveModule: Text(Utf8Bytes(b"0{\"sid\":\"[hidden]\",\"upgrades\":[],\"pingInterval\":25000,\"pingTimeout\":20000,\"maxPayload\":1000000}"))
2026-03-04T00:09:36.106230Z DEBUG TwoStepRule: Checking message against pattern '451-["successupdateBalance",': Text(Utf8Bytes(b"0{\"sid\":\"[hidden]\",\"upgrades\":[],\"pingInterval\":25000,\"pingTimeout\":20000,\"maxPayload\":1000000}"))
2026-03-04T00:09:36.106772Z DEBUG TwoStepRule: Checking message against pattern '451-["updateStream",': Text(Utf8Bytes(b"0{\"sid\":\"[hidden]\",\"upgrades\":[],\"pingInterval\":25000,\"pingTimeout\":20000,\"maxPayload\":1000000}"))
2026-03-04T00:09:36.107294Z DEBUG InitModule: Processing text message: 0{"sid":"[hidden]","upgrades":[],"pingInterval":25000,"pingTimeout":20000,"maxPayload":1000000}
2026-03-04T00:09:36.107496Z DEBUG InitModule: Received Engine.IO handshake (0). Sending Socket.IO connect (40)...
2026-03-04T00:09:36.163623Z DEBUG Router: Routing message: Text(Utf8Bytes(b"40{\"sid\":\"[hidden]\"}"))
2026-03-04T00:09:36.164173Z DEBUG Lightweight: Received: Text(Utf8Bytes(b"40{\"sid\":\"[hidden]\"}"))
2026-03-04T00:09:36.164917Z DEBUG LightweightModule: Routing rule for KeepAliveModule: Text(Utf8Bytes(b"40{\"sid\":\"[hidden]\"}"))
2026-03-04T00:09:36.165220Z DEBUG TwoStepRule: Checking message against pattern '451-["successupdateBalance",': Text(Utf8Bytes(b"40{\"sid\":\"[hidden]\"}"))
2026-03-04T00:09:36.165528Z DEBUG TwoStepRule: Checking message against pattern '451-["updateStream",': Text(Utf8Bytes(b"40{\"sid\":\"[hidden]\"}"))
2026-03-04T00:09:36.165909Z DEBUG InitModule: Processing text message: 40{"sid":"[hidden]"}
2026-03-04T00:09:36.166148Z DEBUG InitModule: Socket.IO session established (40{"sid":"[hidden]"}). Sending auth SSID: RealSsid(uid=[hidden]...
2026-03-04T00:09:36.221318Z DEBUG tungstenite::protocol: Received close frame: None
2026-03-04T00:09:36.221919Z DEBUG tungstenite::protocol: Replying to close with Frame { header: FrameHeader { is_final: true, rsv1: false, rsv2: false, rsv3: false, opcode: Control(Close), mask: None }, payload: b"" }
2026-03-04T00:09:36.222235Z DEBUG Router: Routing message: Close(None)
2026-03-04T00:09:36.222618Z DEBUG Lightweight: Received: Close(None)
2026-03-04T00:09:36.222808Z DEBUG LightweightModule: Routing rule for KeepAliveModule: Close(None)
2026-03-04T00:09:36.222986Z DEBUG TwoStepRule: Checking message against pattern '451-["successupdateBalance",': Close(None)
2026-03-04T00:09:36.223114Z DEBUG TwoStepRule: Checking message against pattern '451-["updateStream",': Close(None)
2026-03-04T00:09:36.284440Z  WARN Runner: Connection lost unexpectedly.
2026-03-04T00:09:36.284703Z DEBUG Runner: Starting connection cycle...
2026-03-04T00:09:36.284830Z DEBUG PocketConnect: Initiating graceful disconnect sequence...
2026-03-04T00:09:36.285076Z DEBUG PocketConnect: Sent Socket.io disconnect signal (41).
2026-03-04T00:09:36.285255Z DEBUG PocketConnect: Closing WebSocket transport.
2026-03-04T00:09:36.285507Z DEBUG PocketUtils: Trying geo provider: https://i.pn/json/46.21.81.[xxx]
2026-03-04T00:09:36.285792Z DEBUG reqwest::connect: starting new connection: https://i.pn/
2026-03-04T00:09:36.287676Z DEBUG hyper_util::client::legacy::connect::http: connecting to 134.119.216.174:443
2026-03-04T00:09:36.288699Z DEBUG hyper_util::client::legacy::connect::http: connected to 134.119.216.174:443
2026-03-04T00:09:36.582973Z DEBUG PocketUtils: Found location via https://i.pn/json/46.21.81.111: 37.308, 49.5821
2026-03-04T00:09:36.582974Z DEBUG hyper_util::client::legacy::pool: pooling idle connection for ("https", i.pn)

I even checked the IP address not to be associated with a hosting provider (on a location provider). What could be the cause?

P.S. the site itself operates nice smoothly, without any outages and/or reconnects.

potionsnotusedlol avatar Mar 04 '26 00:03 potionsnotusedlol

Thank you for your time, I have copied and pasted the the full get_candles code and enabled the logs. There is an infinite loop of websocket reconnections, to which I have no explanation. Here's the logs:

[LOGS]

I even checked the IP address not to be associated with a hosting provider (on a location provider). What could be the cause?

P.S. the site itself operates nice smoothly, without any outages and/or reconnects.

I can look into this in about 2 and a half hours, thanks for the detailed logs. We appreciate your patience. Also, your IP isn't fully censored. I would recommend releasing and renewing your IP to prevent any bad actors- and also editing and/or deleting your logs message to remove IP and geolocation.

Best, Six.

sixtysixx avatar Mar 04 '26 00:03 sixtysixx

Could you check if the IP on the PO website matches your IP on the SSID? If it doesn't- please clear cache and cookies, and login again. Then use that SSID and let me know if that works.

https://r2.e-z.host/a466cf7c-0034-4d68-80d8-1c7ad54cf3c3/w8seyra5.png

sixtysixx avatar Mar 04 '26 00:03 sixtysixx

@potionsnotusedlol Im unable to reproduce this issue.

Here are some troubleshooting steps that you can take, let me know if these work or not, preferably do these in order-

1a. create a new venv with python 3.12 or 3.13 using uv or pyenv 1b. if you installed using uv, youll have to ensure pip (python -m ensurepip) and use python -m pip after activating/sourcing venv 2. install BOTV2 from source using Option C in the README 3. clear cookies and cache OR open a new browser session/profile (not a tab, a clean blank slate or guest mode on chrome) 4. install a userscript manager (such as violentmonkey) and install the SSID fetcher 5. head to PO and ensure the userscript is enabled 6. Once prompted, click yes to show your SSID, Itll look like this 7. Copy the ENTIRE string, from 42 to the closing square bracket.

Let me know if this solves your issue.

Best wishes, Six

sixtysixx avatar Mar 04 '26 02:03 sixtysixx

Thank you so much! Still can't believe it worked. For more context, for me it worked on macOS after initiating .venv with uv using python 3.12, doing ensure pip, getting all the packages using python -m pipand installing BOTV2 from this repo. Also ofc refreshing all the caches. I didn't use no violentmonkey bc I'm pretty sure I know how to copy WS messages).

Though there is some problem running the "Option C" (installing using pip from source) on my Ubuntu server (cannot build the lib's wheel, but I think it's bc I didn't install Rust on it).

Anyway, it's a huge leap forward for me, very grateful for your help!

potionsnotusedlol avatar Mar 04 '26 21:03 potionsnotusedlol

Glad to help. Thank you for your patience. Ill make sure to note the rust requirement(s) when using option C.

Best of luck, and happy trading, Six

sixtysixx avatar Mar 04 '26 21:03 sixtysixx