Matrix server login via token missing

Hi,

there seems to be matrix chat support in HA. Unfortunately token based login doesn’t work. This is needed in web services often if one uses 2fa. Also, leaving password in configured in different systems plaintext is not a good habit.

A while back I created a ticket about it. I wonder why bot closed it? I don’t see commit referenced in issue, nor comment that issue would be denied.

Anyhow, I post also here if anyone would get interested to fix it. Matrix is super nice chat tool, like open source discord or slack. Too bad integration doesn’t work in such rather typical case, it would be good to have.

3 Likes

This. Using username & password is a bit barbaric and doesn’t work with SSO based authentication. @PaarthShah any comments on this?

2 Likes

Yes, or would it be possible to reopen the issue?

I ran into this issue today as well. My users use SSO to authenticate to Element/Synapse/Matrix/whatever you want to call it, and we have to enable password authentication solely because this plugin doesn’t support tokens.

Additionally, the plugin doesn’t seem to re-authenticate the user session. Our synapse configuration is following best practices and includes a session timeout. With that being the case, the HomeAssistant integration stops working after the timeout period. The logs show:

Restoring login from access token failed: M_UNKNOWN_TOKEN, Access token has expired

This can be resolved by restarting home assistant, but if we could generate a long-lived token for the HA matrix user, that would be unnecessary.

Security is paramount in this day and age, this should be a priority. I would be willing to contribute to sponsoring such a change.