Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Life 360 Integration - Invalid Authentication with correct details #97470

Closed
aaronburt opened this issue Jul 30, 2023 · 134 comments · Fixed by pnbruckner/life360#7 or #97549
Closed

Life 360 Integration - Invalid Authentication with correct details #97470

aaronburt opened this issue Jul 30, 2023 · 134 comments · Fixed by pnbruckner/life360#7 or #97549
Assignees

Comments

@aaronburt
Copy link

aaronburt commented Jul 30, 2023

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

@home-assistant
Copy link

Hey there @pnbruckner, mind taking a look at this issue as it has been labeled with an integration (life360) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of life360 can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign life360 Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


life360 documentation
life360 source
(message by IssueLinks)

@sdholden28
Copy link

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

@lesourcil
Copy link

Same issue here

@Teammie73
Copy link

Same here .

@blockarchitech
Copy link

blockarchitech commented Jul 30, 2023

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.

@marc-gist
Copy link

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 :(

@jleach87
Copy link

+1

2 similar comments
@majorsl
Copy link

majorsl commented Jul 30, 2023

+1

@David-65
Copy link

+1

@jurekam
Copy link

jurekam commented Jul 30, 2023

Same here.

@kubbur
Copy link

kubbur commented Jul 30, 2023

Same

@marc-gist
Copy link

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

@jasonalsing
Copy link

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.

Myself included, however to note I also couldn't login via the app at first, until I updated the app from the Play Store. So seems they have changed some auth mechanism.

@AnthonyBe
Copy link

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

@justinmaiuto
Copy link

Following, same issue here

@gregtakacs
Copy link

I removed the integration and an attempt at adding again renders the following in the log:

2023-07-29 23:23:54.285 DEBUG (MainThread) [life360.api] Error while getting authorization token, attempt 1: ClientResponseError(RequestInfo(url=URL('https://api-cloudfront.life360.com:443/v3/oauth2/token.json'), method='GET', headers=<CIMultiDictProxy('Host': 'api-cloudfront.life360.com', 'User-Agent': 'HomeAssistant/2023.7.3 aiohttp/3.8.5 Python/3.11', 'Accept': 'application/json', 'cache-control': 'no-cache', 'Accept-Encoding': 'gzip, deflate')>, real_url=URL('https://api-cloudfront.life360.com:443/v3/oauth2/token.json')), (<ClientResponse(https://api.life360.com/v3/oauth2/token.json) [301 Moved Permanently]>
<CIMultiDictProxy('Server': 'awselb/2.0', 'Date': 'Sun, 30 Jul 2023 04:23:54 GMT', 'Content-Type': 'text/html', 'Content-Length': '134', 'Connection': 'keep-alive', 'Location': 'https://api-cloudfront.life360.com:443/v3/oauth2/token.json')>
,), status=403, message='Forbidden', headers=<CIMultiDictProxy('Date': 'Sun, 30 Jul 2023 04:23:54 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Vary': 'Accept-Encoding', 'Access-Control-Allow-Origin': 'https://api-cloudfront.life360.com', 'Access-Control-Allow-Methods': 'GET, PUT, POST, DELETE, OPTIONS', 'Access-Control-Allow-Headers': 'accept,origin,x-requested-with,authorization,content-type,geolocation,x-location-metadata', 'Access-Control-Allow-Credentials': 'true', 'x-request-id': '<request_id_REDACTED>', 'Content-Encoding': 'gzip', 'CF-Cache-Status': 'DYNAMIC', 'Set-Cookie': '__cf_bm=<cookie_REDACTED>; path=/; expires=Sun, 30-Jul-23 04:53:54 GMT; domain=.life360.com; HttpOnly; Secure; SameSite=None', 'Set-Cookie': '_cfuvid=<REDACTED>; path=/; domain=.life360.com; HttpOnly; Secure; SameSite=None', 'Server': 'cloudflare', 'CF-RAY': '<REDACTED>', 'alt-svc': 'h3=":443"; ma=86400')>)
2023-07-29 23:23:54.286 DEBUG (MainThread) [homeassistant.components.life360] Login error: client is not valid/enabled

It appears that life360 is migrating to cloudflare and they royally screwed the pooch on it.

@alexyao2015
Copy link
Contributor

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.

@gregtakacs
Copy link

Confirmed, change does indeed fix the issue.

@gregtakacs
Copy link

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

@troykelly
Copy link
Contributor

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.

@usedjeans818
Copy link

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?

@gregtakacs
Copy link

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.

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.....

@gregtakacs
Copy link

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.

@craigmate
Copy link

Thanks for the fix, it is working. I was going to wait for life360 to fix their issues on there side, but it seems it taking ages. A quick look at their twitter shows it is a Sh!t show. Users are getting emails that it is working, but it still not letting people login. I also work in I.T and I guess they did this change over the weekend, as it is possibly the quietest time.. but it seems it wasn't tested very well.

@bigboban
Copy link

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?

@sceccola
Copy link

I am still not able to sign in to readd the integration, any ideas

@valsergi
Copy link

Hello, I have the same problem since last night...

My error has been, without looking at anything, of information, thinking that the problem was mine, I have deleted the integration and of course now I cannot include it because it does not recognize my credentials, I will not be able to try the FIX, hopefully they will solve it quickly, we will have to update HA or will it only be a component thing... does anyone know? THANK YOU!

@rdwilson
Copy link

rdwilson commented Aug 1, 2023

Many thanks for the fix.

My instance of HA is running under TrueNAS Scale. A "restart" from the HA menu did not work. A "reboot" did.

@pnbruckner
Copy link
Contributor

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. 😉

@blockarchitech
Copy link

Awesome!! Thank you 🙂

@rockchevy85
Copy link

Thank you. Can I ask a really dumb question, does this mean I need to update my HA Core version to get the new integration? Been putting it off since I'll need to upgrade Python and it'll just be safer to build a new HA from scratch.

@frakman1
Copy link

frakman1 commented Aug 2, 2023

I don't know why you need to put a whole new module in /config instead of making the small fixes in the existing code.

I manually put the fixes from this in /usr/local/lib/python3.11/site-packages/life360/api.py, restarted HA and it works now.

@jcarlier
Copy link

jcarlier commented Aug 2, 2023 via email

@psfales
Copy link

psfales commented Aug 5, 2023

The permanent fix is in 2023.8.1 and it's working for me. Thanks for turning this around so quickly!

@jcarlier
Copy link

jcarlier commented Aug 6, 2023 via email

@smarthomefamilyverrips
Copy link

can i delete the manual Life360 integration after this update ?? Le sam. 5 août 2023 à 23:38, psfales @.> a écrit :

The permanent fix is in 2023.8.1 and it's working for me. Thanks for turning this around so quickly! — Reply to this email directly, view it on GitHub <#97470 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKZUCVTSKV3QO7SBECUUSLXT24MBANCNFSM6AAAAAA24Z72OM . You are receiving this because you commented.Message ID: @.
>

Yes you can delete the folder that you placed in your config after update to 2023.8.1

@petebanham
Copy link

Working for me as well since latest update. Thanks again for sorting

@ridxe
Copy link

ridxe commented Aug 23, 2023

I think life360 broke the api again? As it stopped working with the same errors this morning for me.

@dave-code-ruiz
Copy link

dave-code-ruiz commented Aug 23, 2023

I think too,

i have version 2023.8.3 , i verify in my api.py have _HOST = "api-cloudfront.life360.com"

Error:
Logger: aiohttp.server
Source: components/life360/config_flow.py:140
First occurred: 13:09:52 (4 occurrences)
Last logged: 13:19:48

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 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 296, in async_configure
result = await self._async_handle_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 392, 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

@iamintn
Copy link

iamintn commented Aug 23, 2023

Have not noticed any issues on my instance. Locations are reporting correctly at least. Haven't went too much further.

Home Assistant 2023.8.3
Supervisor 2023.08.1
Operating System 10.5
Frontend 20230802.1 - latest

@dave-code-ruiz
Copy link

I create a month ago one folder in config named life360 with api.py and some files,

i delete it an reboot HA but not work

@blockarchitech
Copy link

If you're still using the old fix, delete it and update HA. Has been working flawlessly for about a month now

@thesoftwarehandyman
Copy link

Interesting, I have 2x 360 accounts in Home Assistant, one is working, the other now fails the same way. Been working ever since the patch, both manual or via integrated. This one went "unknown" at around 3:15pm Eastern yesterday. Maybe something is going on?

@gregtakacs
Copy link

Could it be a cloudflare caching issue? Mine appears to be working fine with no interruptions as of right now....

@redbullstaff
Copy link

sorry, how do you remove the life360 integration?

@piro73
Copy link

piro73 commented Aug 28, 2023

I create a month ago one folder in config named life360 with api.py and some files,

i delete it an reboot HA but not work

same problem....
Home Assistant 2023.8.4
Supervisor 2023.08.1
Operating System 10.5
Frontend 20230802.1 - latest

@dave-code-ruiz
Copy link

I solved my issue going to https://app.life360.com/myaccount and clicking forgoten password, changing password , going to HA and add entry with new password

If work, now you can delete old entry that not work

@pnbruckner
Copy link
Contributor

I'm not sure exactly what is causing the initial situation that causes the system to force a reconfiguration, but it seems once it is in that state, you're stuck, because there is a bug in the HA life360 integration that causes the reconfiguration to fail. I'm going to try and get to the bottom of that and fix it, but in the meantime, a workaround seems to be to change your Life360 password. Then either add the HA life360 integration again, with the new password, which seems to work, and then it seems the old entry can be deleted. Or, some have found, that entering the new password into the entry in .storage/core.config_entries, seems to also work.

@piro73
Copy link

piro73 commented Aug 28, 2023

I solved my issue going to https://app.life360.com/myaccount and clicking forgoten password, changing password , going to HA and add entry with new password

If work, now you can delete old entry that not work

work also for me
thanks

@pnbruckner
Copy link
Contributor

pnbruckner commented Aug 31, 2023

@bmcgair are you using at least 2023.8?

FWIW, the config flow bug fix (that allows reconfiguring an existing config entry that causes a Life360 login, or possibly another error) is in the 2023.9.0b0 release.

I'd recommend using at least 2023.8, deleting any current HA Life360 integration entry (that isn't working), then trying to add it again. I'm still getting some indications that some people are not able to add Life360 to HA, but I have no idea why.

If, after trying all existing suggestions, if you still have trouble adding Life360 to HA, please enable debug (per the following), restart HA, try adding Life360 again, and then find all life360 related messages in the FULL log, including, and especially, debug messages (which don't normally show in the UI), and share them here, or email me, or PM me on the community forum.

logger:
  default: warning
  logs:
    life360: debug
    homeassistant.components.life360: debug

@bmcgair
Copy link

bmcgair commented Aug 31, 2023

Thanks. Working now with 2023.9.0b0. Docker was still using an old image.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet