-
-
Notifications
You must be signed in to change notification settings - Fork 43
Description
This appears like a very featureful add-on and I'd say that the configuration went smoothly since I had no issues getting the OIDC button to show up in the HA login page, nor are there any issues when this add on redirects to my IdP & I complete authentcation and MFA. For the purposes of this configuration, I am using an IdP called Cloud Secure Edge (CSE, formerly Banyan Security), which is actually functioning as a OIDC enabled middle-ware that allows for strengthening authentication flows, and enabled very secure user and device verification workflows. It refers to my primary IdP, OneLogin, to take care of the basic user auth and push-based MFA, then CSE checks for the presence of a user certificate, as another form of MFA. All of this is succeeding though, as I've determined in both the CSE and OneLogin logs. The only place I am getting errors is Home Assistant.
That all said, I do suspect that my claims configuration may need to be tweaked a bit, but that won't be possible until the authentication flow between this add-on and CSE succeeds far enough that the claims are transited from CSE to the add-on. At that point, I can capture the output using an OIDC tracer app, to determine the appropriate claim names, since these are generated, and unconfigurable by CSE. It's a standard implementation practice with CSE that has worked well with my other SP(s). Unfortunately, however, from what I've seen in the authentication flows, it's not getting that far due to this error: Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8!
However, immediately following authentication, as my IdP redirects back to HA, I receive a 500 sever error on a totally blank white webpage:
500 Internal Server Error
Server got itself in trouble
I also receive the following error in home assistant's logs:
Click to unhide log output
2025-12-08 01:13:57.353 ERROR (MainThread) [aiohttp.server] Error handling request from 192.168.98.166
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 510, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 87, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 41, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/auth_oidc/endpoints/callback.py", line 46, in get
user_details = await self.oidc_client.async_complete_token_flow(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
redirect_uri, code, state
^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/config/custom_components/auth_oidc/tools/oidc_client.py", line 694, in async_complete_token_flow
token_response = await self._make_token_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
token_endpoint, query_params
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/config/custom_components/auth_oidc/tools/oidc_client.py", line 390, in _make_token_request
return await response.json()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiohttp/client_reqrep.py", line 756, in json
raise ContentTypeError(
...<7 lines>...
)
aiohttp.client_exceptions.ContentTypeError: 200, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url='https://home-enterprises.trust.banyanops.com/v2/token'
I tried capture the OIDC authentication flow to see if there's anything that stands out, but my "rcFederation Tracer" extension, which can capture SAML, OIDC, and WS-Fed traffic, but there was very minimal information included in the IdP server response. It hasn't even gotten to the point where the claims are retreieved from the IdP to the SP.
Here's additional log output after setting debug logging enabled. I've filtered out the unrelated components. The first two lines seem to repeat indefinitely.
I have set the following to debug log:
homeassistant.core: debug
homeassistant.helpers.http: debug
annotatedyaml.loader: debug
custom_components.auth_oidc: debug
custom_components.auth_oidc.tools.oidc_client: debug
Click to unhide log output
2025-12-08 01:42:47.673 DEBUG (MainThread) [homeassistant.helpers.http] Serving /auth/token to 192.168.98.166 (auth: False)
2025-12-08 01:42:47.683 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/websocket to 192.168.98.166 (auth: False)
2025-12-08 01:42:47.708 INFO (MainThread) [homeassistant.components.websocket_api.http.connection] [546208953056] Initialized trigger
2025-12-08 01:42:47.709 INFO (MainThread) [homeassistant.components.websocket_api.http.connection] [546208953056] Initialized trigger
2025-12-08 01:42:47.712 INFO (SyncWorker_10) [homeassistant.loader] Loaded icloud from homeassistant.components.icloud
2025-12-08 01:42:47.714 INFO (SyncWorker_10) [homeassistant.loader] Loaded spotify from homeassistant.components.spotify
2025-12-08 01:42:47.715 INFO (SyncWorker_10) [homeassistant.loader] Loaded tado from homeassistant.components.tado
2025-12-08 01:42:50.816 INFO (MainThread) [homeassistant.components.automation.testing_log_change] Home Assistant Default Log Level: Running automation actions
2025-12-08 01:42:50.817 INFO (MainThread) [homeassistant.components.automation.testing_log_change] Home Assistant Default Log Level: Executing step call service
2025-12-08 01:42:58.578 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/websocket to 192.168.98.166 (auth: False)
2025-12-08 01:42:58.680 DEBUG (MainThread) [homeassistant.helpers.http] Serving /manifest.json to 192.168.98.166 (auth: False)
2025-12-08 01:43:01.307 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/websocket to 192.168.98.166 (auth: False)
2025-12-08 01:43:01.311 DEBUG (MainThread) [homeassistant.helpers.http] Serving /manifest.json to 192.168.98.166 (auth: False)
2025-12-08 01:43:01.481 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/config/automation/config/1765172696003 to 192.168.98.166 (auth: True)
2025-12-08 01:43:03.770 INFO (MainThread) [homeassistant.components.automation.testing_log_change] Home Assistant Default Log Level: Running automation actions
2025-12-08 01:43:03.770 INFO (MainThread) [homeassistant.components.automation.testing_log_change] Home Assistant Default Log Level: Executing step call service
2025-12-08 01:43:06.968 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/hassio/host/logs/boots to 192.168.98.166 (auth: True)
2025-12-08 01:43:06.971 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/hassio/core/logs to 192.168.98.166 (auth: True)
2025-12-08 01:43:07.074 INFO (MainThread) [homeassistant.components.websocket_api.http.connection] [546908581664] Initialized trigger
2025-12-08 01:43:07.075 INFO (MainThread) [homeassistant.components.websocket_api.http.connection] [546908581664] Initialized trigger
2025-12-08 01:43:07.077 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/hassio/core/logs/follow to 192.168.98.166 (auth: True)
2025-12-08 01:43:07.195 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/hassio/core/logs to 192.168.98.166 (auth: True)
2025-12-08 01:43:07.831 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/core/state to 172.30.32.2 (auth: True)
2025-12-08 01:43:13.585 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/core/state to 172.30.32.2 (auth: True)
2025-12-08 01:43:13.587 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/services to 172.30.32.2 (auth: True)
2025-12-08 01:43:13.596 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/core/state to 172.30.32.2 (auth: True)
2025-12-08 01:43:13.599 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/events to 172.30.32.2 (auth: True)
2025-12-08 01:43:13.603 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/core/state to 172.30.32.2 (auth: True)
2025-12-08 01:43:13.606 DEBUG (MainThread) [homeassistant.helpers.http] Serving /api/states to 172.30.32.2 (auth: True)
2025-12-08 01:43:14.711 DEBUG (MainThread) [homeassistant.helpers.http] Serving /auth/oidc/callback to 192.168.98.166 (auth: False)
2025-12-08 01:43:14.711 WARNING (MainThread) [custom_components.auth_oidc.tools.oidc_client] Failed to complete token flow, returning None. ()
2025-12-08 01:43:14.713 DEBUG (MainThread) [custom_components.auth_oidc.views.loader] Fetching template welcome.html from disk
2025-12-08 01:43:14.714 DEBUG (MainThread) [custom_components.auth_oidc.views.loader] Fetching template base.html from disk
2025-12-08 01:43:14.715 DEBUG (MainThread) [custom_components.auth_oidc.views.loader] Fetching template error.html from disk
2025-12-08 01:43:14.725 DEBUG (MainThread) [custom_components.auth_oidc.views.loader] Fetching template finish.html from disk
2025-12-08 01:43:15.336 DEBUG (MainThread) [homeassistant.helpers.http] Serving /auth/oidc/callback to 192.168.98.166 (auth: False)
2025-12-08 01:43:16.805 DEBUG (MainThread) [homeassistant.helpers.http] Serving /auth/oidc/redirect to 192.168.98.166 (auth: False)
2025-12-08 01:43:16.805 DEBUG (MainThread) [custom_components.auth_oidc.tools.oidc_client] Creating HTTP session provider with options: verify certificates: False, custom CA file: None
2025-12-08 01:43:29.102 DEBUG (MainThread) [homeassistant.helpers.http] Serving /auth/oidc/callback to 192.168.98.166 (auth: False)
2025-12-08 01:43:29.194 ERROR (MainThread) [aiohttp.server] Error handling request from 192.168.98.166
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 510, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 87, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 41, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/auth_oidc/endpoints/callback.py", line 46, in get
user_details = await self.oidc_client.async_complete_token_flow(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
redirect_uri, code, state
^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/config/custom_components/auth_oidc/tools/oidc_client.py", line 694, in async_complete_token_flow
token_response = await self._make_token_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
token_endpoint, query_params
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/config/custom_components/auth_oidc/tools/oidc_client.py", line 390, in _make_token_request
return await response.json()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiohttp/client_reqrep.py", line 756, in json
raise ContentTypeError(
...<7 lines>...
)
aiohttp.client_exceptions.ContentTypeError: 200, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url='https://home-enterprises.trust.banyanops.com/v2/token'
I appreciate your time for reading this and please let me know what information I can provide.
Thank you,
Brian