pnbruckner / life360

A simple python life360 client
MIT License
16 stars 6 forks source link

Update life360 endpoints #7

Closed alexyao2015 closed 11 months ago

alexyao2015 commented 11 months ago

Fixes https://github.com/home-assistant/core/issues/97470

Endpoints and client token were updated by life360. The endpoints were updated to the new ones. It seems like the user agent is now also being checked, so this is set to the life360 user agent as well. It appears from usage that the api spec is the same as before.

robertvanlienden commented 11 months ago

LGTM 👍 . Dropped the life360 folder inside my config folder on an Docker-compose installation of HA, and this seems to work.

pnbruckner commented 11 months ago

How did you come up with these new values?

alexyao2015 commented 11 months ago

I used a mitm with the android app.

fenen001 commented 11 months ago

#robertvanlienden, how did you drop the Life360 folder. I did exactly the same, drop the Life360 folder in the config folder but not working. I have HA in a docker container on my Synology NAS. See the link for the folders.

Thank you for your help!!

Scherm­afbeelding 2023-08-01 om 16 55 36
pnbruckner commented 11 months ago

Note that the fix is included in HA release 2023.8.0b3. You should no longer need to copy this package's files directly to your config folder.

ryanbuckner commented 11 months ago

@pnbruckner - This solution worked for the Life360 plugin I've written for Indigo Domotics HA. Thanks so much for this fix. Here's my plugin if you're interested

pnbruckner commented 11 months ago

@ryanbuckner don't thank me, thank @alexyao2015 who came up with the solution.

robertvanlienden commented 11 months ago

#robertvanlienden, how did you drop the Life360 folder. I did exactly the same, drop the Life360 folder in the config folder but not working. I have HA in a docker container on my Synology NAS. See the link for the folders.

Thank you for your help!!

Scherm­afbeelding 2023-08-01 om 16 55 36

Are you sure you are using the right branch?

fenen001 commented 11 months ago

Hi Robert, thank you for your response. Which branch did you use? Can you share the link? Thanks.

pnbruckner commented 11 months ago

Everyone, as mentioned above, the fix is in the HA 2023.8.0 release. Also, it seems the fix may no longer be required. If you can't or don't want to upgrade to HA 2023.8.0, and it seems you still need the fix, you can use the latest release of this package. You can do that by editing homeassistant/components/life360/manifest.json, or you can drop a copy of the main branch of this repo into your config folder (so that it looks like the directory listing in the comment above.)

pnbruckner commented 11 months ago

I used a mitm with the android app.

@alexyao2015, could you share with me the details of how you did this? I tried a couple different ways but failed miserably. I would really like to be able to do this so I can do a better job of maintaining this package and the corresponding HA integration.

ryanbuckner commented 11 months ago

Also, it seems the fix may no longer be required.

Can you elaborate on this?

pnbruckner commented 11 months ago

Can you elaborate on this?

It seems Life360 temporarily changed its API details -- specifically the URL, and possibly the token & header requirements. The "fix" updated this package to compensate for those changes. However, a day or so after that happened, it seems Life360 changed its API again so that it now seems to accept the older & newer API details. Again, this is an undocumented & unsupported API, so there's no real way to know for sure, or if it will change again suddenly and without warning. But, some people have reported that they did not make any changes to their HA install (i.e., they did not install the temporary fix, or update to 2023.8.0 which includes the same "fix"), yet their life360 entities have started working again.

ryanbuckner commented 11 months ago

Thanks. I've seen issues "fix themselves" before so I'm not surprised. Looks like the Life360 team develops straight into production :)

alexyao2015 commented 11 months ago

I did it using mitmproxy, frida, and this frida script https://github.com/httptoolkit/frida-android-unpinning

I used my physical rooted phone with frida. I also saw this that seems promising, but I've never tried it so YMMV. https://github.com/freeload101/Java-Android-Magisk-Burp-Objection-Root-Emulator-Easy

mikeage commented 11 months ago

I did it using mitmproxy, frida, and this frida script https://github.com/httptoolkit/frida-android-unpinning

I used my physical rooted phone with frida. I also saw this that seems promising, but I've never tried it so YMMV. https://github.com/freeload101/Java-Android-Magisk-Burp-Objection-Root-Emulator-Easy

If you haven't seen it, you may want to also check out https://github.com/sensepost/objection/ . Under the hood it's frida, but it has a lot of really nice scripts built in, and can be quicker for most stuff.