core: Life 360 Integration - Invalid Authentication with correct details

The problem

I’ve noticed that around 1 am GMT, the life360 integration stopped working and prompted me with ‘Invalid authentication.’ Despite trying to provide the correct details and attempting to reboot and reinstall the integration, it still didn’t work. Interestingly, I was able to log out and log back into the Android app successfully, which suggests that they might have made some changes that affected the integration.

In the logs I’ve provided, it appears that Python is generating an ‘empty auth header.’ It’s possible that 360 now requires an additional header that is not being passed.

What version of Home Assistant Core has the issue?

core-2023.7.1

What was the last working version of Home Assistant Core?

core-2023.7.1

What type of installation are you running?

Home Assistant Container

Integration causing the issue

life360

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Source: config_entries.py:1297
First occurred: 00:52:15 (1 occurrences)
Last logged: 00:52:15

Config entry '{REDACTED EMAIL}' for life360 integration could not authenticate: empty auth header

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/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 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 87, in delete
    result = await hass.config_entries.async_remove(entry_id)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1091, in async_remove
    del self._entries[entry.entry_id]
        ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: '52820af4979e35990df416e586b730a2'

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 150
  • Comments: 134 (5 by maintainers)

Most upvoted comments

FYI I just created a fix for this. If you want to use it now, you can download this repo and copy the life360 folder to the root of your config directory. Restart to apply changes.

Please Just use the “thumb up” on the original post if you have the same issue rather than clutter up the comments.

Hi all. I just released a new version of the life360 pypi.org package that includes the change provided by @alexyao2015 that compensates for the Life360 API changes. Next I need to submit an update to the HA built-in life360 integration to pick up that new package version.

And, yes, this HA integration uses an undocumented & unsupported Life360 API that was reverse engineered years ago by people I don’t even know. We’ve been lucky for many years, but this was bound to happen some day. Hopefully it won’t happen again for another 5 or so years. 😉

Home Assistant 2023.7.3 Supervisor 2023.07.1 Operating System 10.3

For completeness and searchability, the error dialog I’m seeing now on the integration, when I click Reconfigure, is: image

Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble

HA Log:

2023-07-30 13:53:58.344 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/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 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 172, in get
    return await super().get(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 96, in get
    result = await self._flow_mgr.async_configure(flow_id)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 297, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 393, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/life360/config_flow.py", line 140, in async_step_reauth_confirm
    self._password = user_input[CONF_PASSWORD]
                     ~~~~~~~~~~^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

Same issue. Had the 500 errors, but now I can no longer login.

Should also note, I was logged out of the mobile app and forced to re-login around the same time HA reported Life360 stopped working.

I now only get 500 error. Also can’t remove the integration 😦

Can confirm the issue. This is likely affecting all users currently.

Same issue. Had the 500 errors, but now I can no longer login.

Should also note, I was logged out of the mobile app and forced to re-login around the same time HA reported Life360 stopped working.

It works for me now. I took wrong branch.

Any chance for a link - cant seem to find the download area. the one i found, doesnt work it seems.

So download the main branch and put in the folder life360 in the config directory and then go here and on the far right hand side you should see the word RAW and two icons to the right is download raw file. Download and then replace the api.py file in the life360 folder and restart.

Worked for me.

lcsneil

The temporary fix did NOT work for me when I downloaded from the following link: https://github.com/alexyao2015/life360-python

The temporary fix DOES work for me when I download from the following link: https://github.com/alexyao2015/life360-python/tree/485e063e67018b942f474999555b99e7d912fc3f

IDK if there’s a difference, but one works for me and the other doesn’t.

Here’s a direct link. Click the green code button, then click download zip. Copy the life360 folder to the root of your config directory. Restart to apply changes. Credit to @alexyao2015.

https://github.com/alexyao2015/life360-python/tree/485e063e67018b942f474999555b99e7d912fc3f

The temporary fix did NOT work for me when I downloaded from the following link: https://github.com/alexyao2015/life360-python

The temporary fix DOES work for me when I download from the following link: https://github.com/alexyao2015/life360-python/tree/485e063e67018b942f474999555b99e7d912fc3f

IDK if there’s a difference, but one works for me and the other doesn’t.

Same for me

To those having a problem with the files not working , I , like other above, was having the same issue and I had incorrectly downloaded the master branch of the code, Here is the direct link to the fix code, it is posted above but re posting for those that missed it.

https://github.com/alexyao2015/life360-python/tree/485e063e67018b942f474999555b99e7d912fc3f

[goldbe4804] you need to extract the zip copy only folder life360 to root of Hass config folder Note: The life360 folder is inside the folder life360-python-485e063e67018b942f474999555b99e7d912fc3f Reboot Hass

Mind you they broke the ife360 API for legitimiate users of the app too not just the reverse engineered HA integration. TL;DR I would not put such a prod change in on a Friday/Saturday but then again I’m not the oncall for this so…

We perform our Prd changes on weekends. I guess it depends on the customer base you have.

That sounds like a terrible engineer experience. What’s the release cadence? Who is supporting it if something goes wrong? I would hate to have to work weekends on every release cycle or live in fear that I would get called in because someone broke something unrelated to my stuff but that’s just me…

Or they don’t have customers…heh

Before I download the fix, generally, how quickly is a new HA build released when an Intergration has an issue like this? I don’t mind waiting a few days.

I downloaded repo mentioned above but it does NOT fix the issue. I put “life360” directory in CONFIG and second try in custom_components but no result. Life360 still broken. What is wrong?

FYI I just created a fix for this. If you want to use it now, you can download this repo and copy the life360 folder to the root of your config directory. Restart to apply changes.

Thanks @alexyao2015 , the repo fixed my issue. However, a quick question (sorry if this is a n00b question). Will I have to remove the config/life360 folder once the official fix is released?

Yes, once the pull request gets folded into the python library and the new library version gets incorporated into a new HA release you should be able to remove the life360 dir you just added to your instance.

I wonder who at life360 would think it’s a good idea to roll out breaking changes on Saturday…

A company with users accessing their API outside of their application in an unintended fashion.

Something we need to be careful about - given the recent changes by other large API’s suddenly charging for (or preventing) access.

I wonder who at life360 would think it’s a good idea to roll out breaking changes on Saturday…

To those having a problem with the files not working , I , like other above, was having the same issue and I had incorrectly downloaded the master branch of the code, Here is the direct link to the fix code, it is posted above but re posting for those that missed it.

https://github.com/alexyao2015/life360-python/tree/485e063e67018b942f474999555b99e7d912fc3f

The temp fix worked for me thanks a lot

Root/config is the correct place. Here you have to copy the folder life360 with the new api.py. Restart home assistant and then it works.

Best regards Peer

Hi Guys No idea why but i cannot see the intergration folder in my setup! What is the exact path please image

image

wmrato --TY i took the life 360… folder out of the life 360 folder rebooted - it works TY – can you delete the folder when done -just wondering !!

FYI I just created a fix for this. If you want to use it now, you can download this repo and copy the life360 folder to the root of your config directory. Restart to apply changes.

Seems this fix did work for me 👍

This worked , it took a bit for me to figure out how to download that directory with the updated api.py.

I cloned the main repo, copied the life360 directory, then when into the branch link above and downloaded api.py and copied it in the life 360 director. Restarted HA and works.

You all are brilliant.