Use My Home Assistant for OAuth2 redirect callbacks (#72449)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>pull/72474/head
parent
b9baaf573c
commit
38ad1ef233
|
@ -37,6 +37,7 @@ DATA_IMPLEMENTATIONS = "oauth2_impl"
|
|||
DATA_PROVIDERS = "oauth2_providers"
|
||||
AUTH_CALLBACK_PATH = "/auth/external/callback"
|
||||
HEADER_FRONTEND_BASE = "HA-Frontend-Base"
|
||||
MY_AUTH_CALLBACK_PATH = "https://my.home-assistant.io/redirect/oauth"
|
||||
|
||||
CLOCK_OUT_OF_SYNC_MAX_SEC = 20
|
||||
|
||||
|
@ -129,6 +130,9 @@ class LocalOAuth2Implementation(AbstractOAuth2Implementation):
|
|||
@property
|
||||
def redirect_uri(self) -> str:
|
||||
"""Return the redirect uri."""
|
||||
if "my" in self.hass.config.components:
|
||||
return MY_AUTH_CALLBACK_PATH
|
||||
|
||||
if (req := http.current_request.get()) is None:
|
||||
raise RuntimeError("No current request in context")
|
||||
|
||||
|
|
Loading…
Reference in New Issue