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’.
I logged into common google account
Exported the cookies
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.
@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.
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.
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:
__Secure-1PSID
__Secure-3PSID
__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
there was a race condition and google updated the cookies between your export and deletion
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
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.
Log into google maps using browser
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)
Export your cookies and import into haas except __Secure-1PSIDTS.
Delete your cookies using ‘edit this cookie’
DO NOT log into same google account from anywhere again.