From 653c716ea8ca158f0641072f2a99f6b45762a103 Mon Sep 17 00:00:00 2001 From: Christiaan Goossens <9487666+christiaangoossens@users.noreply.github.com> Date: Fri, 6 Feb 2026 11:07:46 +0100 Subject: [PATCH] Fix 500 on redirect path (#201) * Fix 500 on redirect path Co-authored-by: anntnzrb --- custom_components/auth_oidc/endpoints/redirect.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/custom_components/auth_oidc/endpoints/redirect.py b/custom_components/auth_oidc/endpoints/redirect.py index 7e59da6..66c568b 100644 --- a/custom_components/auth_oidc/endpoints/redirect.py +++ b/custom_components/auth_oidc/endpoints/redirect.py @@ -24,11 +24,14 @@ class OIDCRedirectView(HomeAssistantView): async def get(self, _: web.Request) -> web.Response: """Receive response.""" - redirect_uri = get_url("/auth/oidc/callback", self.force_https) - auth_url = await self.oidc_client.async_get_authorization_url(redirect_uri) + try: + redirect_uri = get_url("/auth/oidc/callback", self.force_https) + auth_url = await self.oidc_client.async_get_authorization_url(redirect_uri) - if auth_url: - return web.HTTPFound(auth_url) + if auth_url: + raise web.HTTPFound(auth_url) + except RuntimeError: + pass view_html = await get_view( "error",