From 9c205a6c3d8417da09483dff5bea2688dd87544f Mon Sep 17 00:00:00 2001 From: mrlt8 <67088095+mrlt8@users.noreply.github.com> Date: Sun, 22 Aug 2021 11:26:00 +0900 Subject: [PATCH] Fix 2FA 400 Error Fix for #83 --- README.md | 4 ++++ app/wyze_bridge.py | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 43dfd5af..3fb57de0 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,10 @@ If you wish to continue using your camera with the bridge, you should downgrade | V3 | 4.36.2.5 (June 14, 2021) | āœ… 4.36.2.5 | | PAN | 4.10.6.241 (March 9, 2021) | āŒ 4.10.7.798 | +## Changes in v0.5.11 + +- Fix bug in 2FA when submitting verification resulted in "400" Error + ## Changes in v0.5.10 - Check for DTLS status instead of firmware version for compatibility diff --git a/app/wyze_bridge.py b/app/wyze_bridge.py index d48002f9..083f8e9b 100644 --- a/app/wyze_bridge.py +++ b/app/wyze_bridge.py @@ -21,7 +21,7 @@ class wyze_bridge: def __init__(self): - print("\nšŸš€ STARTING DOCKER-WYZE-BRIDGE v0.5.10") + print("\nšŸš€ STARTING DOCKER-WYZE-BRIDGE v0.5.11") if "DEBUG_LEVEL" in os.environ: print(f'DEBUG_LEVEL set to {os.environ.get("DEBUG_LEVEL")}') debug_level = getattr(logging, os.environ.get("DEBUG_LEVEL").upper(), 10) @@ -92,6 +92,9 @@ def auth_wyze(self): ) sms_resp.raise_for_status() self.log.info(f"šŸ’¬ SMS code requested") + json_resp["mfa_options"] = "PrimaryPhone" + else: + json_resp["mfa_options"] = "TotpVerificationCode" while True: if os.path.exists(mfa_token) and os.path.getsize(mfa_token) > 0: with open(mfa_token, "r+") as f: @@ -106,7 +109,7 @@ def auth_wyze(self): "password": wyzecam.api.triplemd5( os.environ["WYZE_PASSWORD"] ), - "mfa_type": json_resp["mfa_options"][0], + "mfa_type": json_resp["mfa_options"], "verification_id": sms_resp.json()["session_id"] if "sms_resp" in vars() else json_resp["mfa_details"]["totp_apps"][0][