core: Home Connect Auth Error

The problem

After Update, HA says “Integration requires reconfiguration” Reonfiguration doesn’t work. “No devices or entities Setup error: Authentication error: The provided token is malformed. (invalid_token). Please authenticate your account again.”

Image

What version of Home Assistant Core has the issue?

core-2025.3.0

What was the last working version of Home Assistant Core?

core-2025.2.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Home Connect

Link to integration documentation on our website

https://www.home-assistant.io/integrations/home_connect/

Diagnostics information

Example YAML snippet


Anything in the logs that might be useful for us?

2025-03-06 20:36:19.771 INFO (MainThread) [homeassistant.components.home_connect.config_flow] Successfully authenticated
2025-03-06 20:36:19.774 DEBUG (MainThread) [aiohomeconnect] Request: GET /homeappliances
2025-03-06 20:36:19.868 DEBUG (MainThread) [aiohomeconnect] Response: 
{
  "error": {
    "key": "invalid_token",
    "description": "The provided token is malformed."
  }
}
2025-03-06 20:36:19.868 DEBUG (MainThread) [homeassistant.components.home_connect.coordinator] Finished fetching 01JNPFAWHWHP9YX2Y86ES1HR0N data in 0.094 seconds (success: False)
2025-03-06 20:36:19.868 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Waschtrockner' for home_connect integration could not authenticate: Authentication error: The provided token is malformed. (invalid_token). Please, re-authenticate your account 

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 10
  • Comments: 70 (30 by maintainers)

Most upvoted comments

This PR works around the issue creating a new separate httpx client for the inexogy integration:

https://github.com/home-assistant/core/pull/141374

It will be included in tomorrow’s beta release of Home Assistant.

If anyone here is not using inexogy, please comment. Then we can continue troubleshooting and looking for integrations that are using httpx under the hood.

But hopefully this was the missing piece and it will be solved in the next release.

Are all of you affected by this issue using the inexogy integration? We found a problem in that integration dependency where it sets auth directly on the shared httpx client.

Installed Core 2025.3.3 and the problem persists. Does anyone have any ideas for a solution? 😦

With Core 2025.4.0, it’s OK! Thanks!

Yes, I am also using that integration.

Yes, I have that Integration in use as well.


Von: Martin Hjelmare @.> Gesendet: Tuesday, March 25, 2025 3:10:06 PM An: home-assistant/core @.> Cc: Martin Grüning @.>; Manual @.> Betreff: Re: [home-assistant/core] Home Connect Auth Error (Issue #139991)

Are all of you affected by this issue using the inexogy integration? We found a problem in that integration dependency where it sets auth directly on the shared httpx client.

— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/139991#issuecomment-2751394840, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AIXWEHTETS35YYDFSMF6LTT2WFIS5AVCNFSM6AAAAABYPQZOM2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONJRGM4TIOBUGA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

[MartinHjelmare]MartinHjelmare left a comment (home-assistant/core#139991)https://github.com/home-assistant/core/issues/139991#issuecomment-2751394840

Are all of you affected by this issue using the inexogy integration? We found a problem in that integration dependency where it sets auth directly on the shared httpx client.

— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/139991#issuecomment-2751394840, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AIXWEHTETS35YYDFSMF6LTT2WFIS5AVCNFSM6AAAAABYPQZOM2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONJRGM4TIOBUGA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

I installed Core 2025.3.2 this morning. The problem persists.

Inexogy sets auth directly on the shared httpx client. Both Inexogy and Home Connect integrations use httpx and the shared client.

It will be fixed in the release that goes out tomorrow.

I tried it out, but it looks a little bit different on my side. It is not using the Bearer token:

INFO:     192.168.5.5:53230 - "GET /headers HTTP/1.1" 500 Internal Server Error
Request headers: {'host': '192.168.5.149:8000', 'accept-encoding': 'gzip, deflate, br', 'connection': 'keep-alive', 'user-agent': 'HomeAssistant/2025.3.4 httpx/0.28.1 Python/3.13', 'authorization': 'Basic aG53[...]E3aw==', 'accept': 'application/vnd.bsh.sdk.v1+json'}

My bearer token is Bearer eyJ4LWV[...]FfO4JMA

I have the same issue and I can confirm that the token is identical and also works with curl.

Debug Log File:

2025-03-20 22:05:29.951 INFO (MainThread) [homeassistant.components.home_connect.config_flow] Successfully authenticated
2025-03-20 22:05:29.955 DEBUG (MainThread) [aiohomeconnect] Request: GET /homeappliances
2025-03-20 22:05:29.955 DEBUG (MainThread) [aiohomeconnect] Headers: {'authorization': 'Bearer eyJ4LWV[...]FfO4JMA', 'accept': 'application/vnd.bsh.sdk.v1+json'}
2025-03-20 22:05:30.042 DEBUG (MainThread) [aiohomeconnect] Response: 
{
  "error": {
    "key": "invalid_token",
    "description": "The provided token is malformed."
  }
}
2025-03-20 22:05:30.042 DEBUG (MainThread) [homeassistant.components.home_connect.coordinator] Finished fetching 01JNXGNYDKXB5YMWS90R971TGG data in 0.088 seconds (success: False)
2025-03-20 22:05:30.043 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Home Connect' for home_connect integration could not authenticate: Authentication error: The provided token is malformed. (invalid_token). Please, re-authenticate your account

cat .storage/core.config_entries

{"created_at":"2025-03-09T13:14:31.731599+00:00","data":{"auth_implementation":"home_connect_49f13c2bfddfe9178df0d7ed185b2e4191db3d0b98831db1fba5cf95e157f13e","token":{"access_token":"eyJ4LWV[...]FfO4JMA","expires_at":1742591129.9516904,"expires_in":86400,"id_token":"eyJ4LWV[...]FfO4JMA","refresh_token":"eyJyZW[...]BSRCJ9","scope":"Settings IdentifyAppliance Control Monitor","token_type":"Bearer"}},"disabled_by":null,"discovery_keys":{},"domain":"home_connect","entry_id":"01JNXGNYDKXB5YMWS90R971TGG","minor_version":2,"modified_at":"2025-03-20T21:05:29.952320+00:00","options":{},"pref_disable_new_entities":false,"pref_disable_polling":false,"source":"user","subentries":[],"title":"Home Connect","unique_id":null,"version":1},

curl -X GET “https://api.home-connect.com/api/homeappliances”
-H “Authorization: Bearer eyJ4LWV[…]FfO4JMA”

{
  "data": {
    "homeappliances": [
      {
        "brand": "Siemens",
        "connected": false,
        "enumber": "XXXXXXXXX",
        "haId": "YYYYYYYYYYYYYYY",
        "name": "Trockner",
        "type": "Dryer",
        "vib": "ZZZZZZZZZ"
      },
      {
        "brand": "Neff",
        "connected": true,
        "enumber": "XXXXXXXXXXXX",
        "haId": "YYYYYYYYYYYYYYYYYY",
        "name": "Geschirrspüler",
        "type": "Dishwasher",
        "vib": "ZZZZZZZZZ"
      }
    ]
  }
}

I hope that helps.

Did you accessed to the Home Assistant container? Access with

docker exec -it homeassistant /bin/bash

(I also updated the above instructions because I forgot to add it)

@MartinHjelmare Sure, result is b53e1913413087c955c335ff40afcd5d -

Btw.: I will be out for the afternoon, so if there’s anything else I can provide, it probably has to wait until the evening, sorry.

I checked a new integration on an older HA Instance on other Device, with same Data and no Problems:

Image

Image

@Diegorro98

A freshly spun up docker container of the version (2025.3.1 - same as I sport on my main homeassistant) presents no issue with Home Connect. Same account, same config, works like a charm.

@MartinHjelmare Thanks for chiming in here, much appreciated.

File contents from my main containers home_connect/api.py are identical to the ones posted by you.

Given that it works for me on a freshly spun up HA Container instance, I think it’s likely that some custom_component presents a culprit here. The contents of my custom_components folder (I do sport 36 custom integrations) seem quite unassuming. No remnants of the previous home_connect custom component there.

Any idea on what to grep for (and where) i.e. in order to figure out if another component is overwriting the domain?

@Diegorro98 Looks, more or less, identical to me 😕

I’ve also gone ahead and used python -m aiohomeconnect get-appliances <client_id> <client_secret>, that also works as expected, so I don’t believe the problem is with the aiohomeconnect library:

2025-03-08 10:30:01.838 DEBUG (MainThread) [aiohomeconnect] Request: GET /homeappliances
2025-03-08 10:30:01.955 DEBUG (MainThread) [aiohomeconnect] Response:
{
  "data": {
    "homeappliances": [
      {
        "brand": "Bosch",
        "connected": true,
        "enumber": "<REDACTED>",
        "haId": "<REDACTED>",
        "name": "Dishwasher",
        "type": "Dishwasher",
        "vib": "<REDACTED>"
      }
    ]
  }
}

Well, 3 users have the problem here. So he is not alone. And I would like to bet that many have simply not yet reported the problem.

In English, “you” can be used for both the second person singular and plural. In this case, it was plural.

No clue about what it is happening… I mean, why does work for everyone except for you…? What does your account or your Home Connect application have that doesn’t allow to use the integration…?

Let’s try another client, the client provided by the library aiohomeconnect (library that we use at Home Assistant), you can use these steps:

  1. (OPTIONAL) I recommend using a virtual environment, but is not necessary

  2. Install aiohomeconnect:

    pip install aiohomeconnect authlib fastapi rich typer uvicorn
    
  3. Run authorization:

    python -m aiohomeconnect authorize <client_id> <client_secret>
    

    this step is the one you should get stuck if there’s something wrong with the oauth.

  4. Try it:

    python -m aiohomeconnect get-appliances <client_id> <client_secret>
    

Well, 3 users have the problem here. So he is not alone. And I would like to bet that many have simply not yet reported the problem.

I spend a few minutes on investigating the issue.

So, I reauthenticated via the Home Assitant integration page & as with all tries before, immediately after reauthenticating, Home Assistant tells me that: The provided token is malformed. (invalid_token)

I then extracted the access token from my core.config_entries and checked it via https://jwt.io/ The resulting decoded token contents look fine:

Header

{
  "x-env": "PRD",
  "alg": "RS256",
  "x-reg": "EU",
  "kid": "reu-production"
}

Payload

{
  "fgrp": [],
  "clty": "private",
  "sub": "<REDACTED>",
  "aud": "<REDACTED>",
  "stage": "PRD",
  "azp": "<REDACTED>",
  "scope": [
    "Settings",
    "IdentifyAppliance",
    "Control",
    "Monitor"
  ],
  "iss": "EU:PRD:1",
  "exp": 1741443881,
  "region": "EU",
  "iat": 1741357481,
  "jti": "<REDACTED>"
}

I then went ahead and used that token to make a curl request to the Home Connect Api to list my appliances

curl -X GET "https://api.home-connect.com/api/homeappliances" \
  -H "Authorization: Bearer {access_token}"

Unsurprisingly, that worked as well:

{
  "data": {
    "homeappliances": [
      {
        "brand": "Bosch",
        "connected": true,
        "enumber": "<REDACTED>",
        "haId": "<REDACTED>",
        "name": "Dishwasher",
        "type": "Dishwasher",
        "vib": "<REDACTED>"
      }
    ]
  }
}

While checking the core.config_entries I noticed something in the Home Connect entry that, I know from experience, can throw off some timestamp parsers and that is the decimal point in the expires_at entry which presents itself in the JSON like this: "expires_at":1741443881.8314924. While being spec compliant, I remember that exactly this did throw a Go application off while parsing something similar. Just a hunch & it does not really correspond with the error message that presents itself in the logs, but yeah, could be something, might be nothing.

Unfortunately, I also have exactly the same error. I can also authenticate myself successfully, but then I immediately receive an authentication error. Unfortunately, the core update I just installed didn’t solve the problem either.

Image

@ugath @Diegorro98 I do have the same issue since updating to 2025.3; I’ve been through the same troubleshooting steps as @ugath, also with no success.

I did not make any changes to my Home Connect Developer Portal Config or the Home Assistant Integration Config before the error appeared.

I’ll check Swagger over the weekend, to see if I’m able to get any more information out of this.