Unifi Protect integration suddenly failing; "Unauthorized"

I’ve been using the unifi protect integration and all of the sudden it is generating errors and devices are failing to integrate. Can anyone advise?

The error: the integration is marked as “needs attention” and “failed to setup”. Detail (tooltip over the “failed to setup” status) is “request failed: /proxy/protect/api/bootstrap - status: 401 - reason: {‘code’: 401, ‘message’: ‘Unauthorized’}”.

The symptoms: devices are effectively dead when viewed in home assistant: no video feeds available and unable to control/issue commands

Other info/what I’ve tried:

  • Unifi Protect is working fine generally (e.g., from the Unifi app)
  • I’ve tried reloading the integration, no luck.
  • I’ve tried re-entering the password, no luck. (Note the username/password do work at the XXX.id.ui.direct URL referenced in the integration.)
  • I have not tried removing the integration and re-adding it, as I have a number of automations and dashboards that reference devices generated by the integration that I do not want to have to rebuild, etc.
  • Things were working fine, then stopped a week or two ago. I did not knowingly change any configuration that should have affected this. (There may have been some application/OS/firmware updates on either the Unifi or Homeassistant side, but I’m not certain if any coincided.)


  • Protect is running on a pair of stacked UNVRs with a static IP address on the local network
  • UniFi OS v4.0.3 (on the UNVRs)
  • Protect v4.0.7

Any help would be appreciated! Thanks!

What ver of HA? You need at least 2024.3.2 to use protect ver 3.0 or higher.

Oops sorry not to list that. Home Assistant Core v.2024.5.2

This is the web login page? The user needs to be local, so it shouldn’t be able to log into the web site. That user also needs full permissions for the protect app.

Yeah this raises an interesting question. I recall that when I initially configured the Protect integration, it was from a “discovered” device and I believe was a local IP address (i.e., the device in the “Discovered” list in HomeAssistant was named something like “Mike’s UNVR (XXX.XXX.X.XX)” (where “Mike’s UNVR” is my UNVR’s name in Unifi and the X’s are a local IP address). At some point it seems to have changed so that it became listed as “Mike’s UNVR (XXXXXXXXX.id.ui.direct)” (but XXX’s replaced with a long alphanumeric string) and possibly this is the same time that things stopped working?

Out of interest I tried going to the URL XXXXXX.id.ui.direct in a web browser and the username/password worked… even though the account that I created for HomeAssistant is local only.

Since I do definitely want the integration to be local, I have deleted that entire integration and am attempting to re-add it. But I don’t seem able to do so.

HomeAssistant has “discovered” 3 different Unifi Protect instances. One I recognize as my UDM (which is capable of running Protect but is not currently), and one of which matches the IP address listed for one of my 2 stacked UNVRs, as listed in Unifi Network. (I am not sure how to figure out the IP address of the second stacked UNVR…) I have tried hitting the configure button for the discovered device for both of these two and in both cases, the username/password is rejected… I have tried resetting the password in Unifi, and carefully pasted/etc. but no luck…

Also, FWIW, if I open a web browser and go to the local IP address listed for the first UNVR followed by “/protect”, I can successfully log in using the username and password that is rejected by the Unifi Protect Integration.

The session cookie name changed with 4.x breaking the integration.

1 Like

There is someone on reddit claiming that they were able to log into 4.0 by creating a new local user. IDK if it will work but it’s worth a try.

1 Like

Actually, that did work…interesting.

1 Like

Do you mean delete the existing Homeassistant account for the Unifi Protect console and then create a new one?

Whoa! That did work! Thanks so much @Mikefila

Hi @Mikefila can you please explain which users/accounts you deleted or re-added? Was it within HA or within Unifi Protect? I am having this same issue as this thread.

Create a new user to log in with.

1 Like