From 8aeb20db00ec07909f9776358cd1dadd926bbd76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joris=20Pelgr=C3=B6m?= Date: Thu, 19 Jan 2023 22:07:08 +0100 Subject: [PATCH] Update allowlisted OAuth redirect URIs for Wear OS in China (#86247) --- homeassistant/components/auth/indieauth.py | 1 + tests/components/auth/test_indieauth.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/homeassistant/components/auth/indieauth.py b/homeassistant/components/auth/indieauth.py index 478f7ab2831..ec8431366ab 100644 --- a/homeassistant/components/auth/indieauth.py +++ b/homeassistant/components/auth/indieauth.py @@ -47,6 +47,7 @@ async def verify_redirect_uri( if client_id == "https://home-assistant.io/android" and redirect_uri in ( "homeassistant://auth-callback", "https://wear.googleapis.com/3p_auth/io.homeassistant.companion.android", + "https://wear.googleapis-cn.com/3p_auth/io.homeassistant.companion.android", ): return True diff --git a/tests/components/auth/test_indieauth.py b/tests/components/auth/test_indieauth.py index 17d1fa927a0..43bd6b71fe5 100644 --- a/tests/components/auth/test_indieauth.py +++ b/tests/components/auth/test_indieauth.py @@ -190,9 +190,19 @@ async def test_verify_redirect_uri_android_ios(client_id): client_id, "https://wear.googleapis.com/3p_auth/io.homeassistant.companion.android", ) + assert await indieauth.verify_redirect_uri( + None, + client_id, + "https://wear.googleapis-cn.com/3p_auth/io.homeassistant.companion.android", + ) else: assert not await indieauth.verify_redirect_uri( None, client_id, "https://wear.googleapis.com/3p_auth/io.homeassistant.companion.android", ) + assert not await indieauth.verify_redirect_uri( + None, + client_id, + "https://wear.googleapis-cn.com/3p_auth/io.homeassistant.companion.android", + )