greghesp / ha-bambulab

A Home Assistant Integration for Bambu Lab Printers
966 stars 85 forks source link

[Bug] Cloudflare is blocking login attempts again #692

Open AdrianGarside opened 2 hours ago

AdrianGarside commented 2 hours ago

Describe the bug

2024-11-06 08:05:41.997 ERROR (SyncWorker_40) [custom_components.bambu_lab.pybambu] Login attempt failed with error code: 403 2024-11-06 08:05:41.997 DEBUG (SyncWorker_40) [custom_components.bambu_lab.pybambu] Response: <!DOCTYPE html>

Attention Required! | Cloudflare ### To Reproduce 2024-11-06 08:05:41.997 ERROR (SyncWorker_40) [custom_components.bambu_lab.pybambu] Login attempt failed with error code: 403 2024-11-06 08:05:41.997 DEBUG (SyncWorker_40) [custom_components.bambu_lab.pybambu] Response: Attention Required! | Cloudflare ### Expected Behaviour Success ### What device are you using? A1 ### Diagnostic Output ```shell 2024-11-06 08:05:41.997 ERROR (SyncWorker_40) [custom_components.bambu_lab.pybambu] Login attempt failed with error code: 403 2024-11-06 08:05:41.997 DEBUG (SyncWorker_40) [custom_components.bambu_lab.pybambu] Response: Attention Required! | Cloudflare ``` ### Log Extracts _No response_ ### Other Information _No response_
AdrianGarside commented 2 hours ago

@t0nyz0 cloudflare is now blocking the new code. I have to go to work now and couldn't find a quick workaround to meet cloudflare expections. I also noticed that the user sign in form you were using in your test app (https://bambulab.com/api/sign-in/form) appears to now be returning a captcha: Enable JavaScript and cookies to continue While https://api.bambulab.com/v1/user-service/user/login hits the cloudflare block.

AdrianGarside commented 1 hour ago

Looking at the new code, it seems that for non-China login attempts the first connection attempt with password is pointless - it is now always going to be told to use the one-time verification code (auto-sent). Instead we could just go directly to requesting that code. However with the prior test app that @t0nyz0 created the login attempt with code is also being cloudflared.