Google maps location sharing problems

if it works, i would be okay updating cookies once a year. so here is what i did, i installed a browser extension called ‘editthiscookie’.

  1. I logged into common google account
  2. Exported the cookies
  3. Used extension editthiscookie to delete all the cookies for google.

I am hoping this will make sure that cookies do not get updated but are still valid. So far (in about 16 hours) location tracking seems to be working okay. Will update how it goes over next few days.

nice work, thanks. I did the same and noticed this time that I don’t get a __Secure-1PSIDTS (which was the problematic one) I’ve restarted my test code and I’ll know in 20mins if this fixed it.

Interestingly, the python lib only mandates :

VALID_COOKIE_NAMES = {'__Secure-1PSID', '__Secure-3PSID'}

Edit : @koying could you check if your cookie file contains __Secure-1PSIDTS ? Thanks.

if the lib only loads these two cookies, then wouldn’t other cookies (including __Secure-1PSIDTS) in file be immaterial ?

No, it checks those two are present (and errors if they are not) but uses the whole file.

makes sense. I am wondering if the lib could update the file with new cookies in file when it receives them as part of response.

I have both.
If the timestamp is to be believed, the cookies will expire May 10th, 2024.

@koying You say you have __Secure-1PSID', '__Secure-3PSID ? But do you also have __Secure-1PSIDTS ? (That seems to be the problematic one)

Ah, no, I don’t have that one.

Good stuff. Thanks

@carefulcomputer do you happen to have an old cookies file (where it stopped working) ? If so, check for __Secure-1PSIDTS - if its there I think it’s a reasonable workaround to proactively removed it when the cookies are extracted.

unfortunately I didn’t save old file. my current cookies file with __Secure-1PSIDTS is still holding fine for more than a day. BTW in my file I see that __Secure-1PSIDTS and __Secure-3PSIDTS both have exact same value.

in my cookie file I see my cookies expire in feb,24 (generated in aug few days back). So doesn’t seem like a full year.

So it sounds like the solution is to remove the problematic cookie entry?

Seems like we want to delete all cookies EXCEPT for __Secure-1PSID and __Secure-3PSID from the cookies file?

Historically I just dump the cookies and copy the file into the hass directory but the last few weeks this only works for ~1 day then it stops working.

I will try this suggested method.

let us know how it goes. for me i saw improvement immediately after I deleted my google shared account cookies from my browser after i exported the cookie.

Alright, so I tested removing cookies, for me, google maps location sharing does not work without the following minimum set of cookies:

  1. __Secure-1PSID
  2. __Secure-3PSID
  3. __Secure-1PSIDTS

I can NOT get rid of the 1PSIDTS cookie that seems to be the root of the problems here. This seems to be the same as what yall are saying when I reread your comments.

So now the next question is if I can delete the google cookies from my local machine I pulled these cookies from and see how long the maps works for. I’ve set up an alert to let me know when a shared user is no longer being updated, so I’ll know shortly after the cookie expires/stops being valid.

When I tried to delete all cookies from google from the browser for the shared account, it seems to have invalidated my cookies that HASS was using and it doesn’t work.

Making another account to ask my friends to share with is a bit ridiculous. Wonder if the solution is to keep a specific version of chrome in a VM or something that is ONLY used for pulling these cookies…

if you use browser’s inbuilt cookie deletion (specially in chrome) there is a possibility that it will log you out (not confirmed). I use an extension called ‘editthiscookie’ which worked perfectly and cookies are still working after deletion.

basic idea is that once you have exported you do not use these cookies anywhere, except in haas. my theory is if you let browser logged into this google account, there are some javascripts which will execute at some events and update cookies and invalidating earlier cookies. However, when you are using haas (locationsharinglib) then there is no javascript, so cookies survive their lifetime.

can you please share the alert which you setup to monitor when location doesn’t update ? I would like to set that up too.

Having some inconsistent results. This worked for about a week but then HA decided my cookies were no good. When I use ‘editthiscookie’ to delete all my cookies, I found my test script failed (Same as @jonofmac reported ) This time, I’ve tried just deleting __Secure-1PSID & __Secure-3PSID to see how it gets on.

that’s strange. deleting the cookies shouldn’t expire them. i can think of two possibility

  1. there was a race condition and google updated the cookies between your export and deletion
  2. in my non scientific experiments, cookies seem to last longer if i logged in google maps and then clicked on each person’s location. if i just logged in google maps and exported the cookies (without checking the locations of other members) then exported cookies won’t work that well.

Mine stopped working after 24 hours again. Logged in this morning and it’s no longer working. Deleting the cookies logged me out of chrome/google. When I log back in, my other cookies got immediately invalidated.

Let me try this using a completely separate browser which I will use for NOTHING but to get these cookies…

Edit: Alright, I fired up edge and logged into google maps. I literally never use edge so this should be a fine test. Let’s see what happens in a day :slight_smile:

Logged in this morning and it’s no longer working. Deleting the cookies logged me out of chrome/google.

Yes deleting the cookies will be log you out of ‘browser’. That is the intent. Your exported cookies are still valid. Idea is that you do not let browser touch those cookies. If you login again in browser, google is killing your previous cookies. Try these steps.

  1. Log into google maps using browser
  2. Go to each member who is sharing their location in google map to see their location (this is just for good measure, not sure if it has any impact. for me it brought good luck)
  3. Export your cookies and import into haas except __Secure-1PSIDTS.
  4. Delete your cookies using ‘edit this cookie’
  5. DO NOT log into same google account from anywhere again.

If I delete secure 1PSIDTS, it doesn’t seem to work for me. It won’t look in. I do delete secure 3 PSIDTS

Here’s an update, it’s been 2 days so far and my cookies I grabbed in edge (a browser I never use), is working still.