Google device tracker and cookies

Apparently you can set a Chrome extension to be allowed in an incognito window.

FWIW, the cookie file I downloaded is about 15 KB (as opposed to only 3 KB for the older, binary format), and has 70 lines. No idea which line(s) is/are necessary, so I just live with it. :slight_smile:

EDIT: I just tried downloading the cookies.txt file from an incognito window and got pretty much the same file. Details are a bit different, but about the same size.

Well that’s interesting… I restarted and got this

The cookie file provided does not provide a valid session. Please create another one and try again.

I’ll do as it tells me and create a new one…

Do I just have to log on to Google?
Literally just go to google.com, logon on and go to google maps and then download the cookies?

I just go directly to the Google Maps site, log in with the account I want to use in HA, click on the cookies.txt icon in the top-right corner, then click on the link in the window that pops up that says “To download cookies for this tab click here”.

1 Like

Thnaks.
I found out how to enable the extension in incognito mode.
So I did pretty much as you described except I did log on to Google before going to Google Maps.

My cookies file is only 1KB and appears to only have two cookies in it.

But…
I got that error message again.

I’ll give it another try…

Personally I’ve had a heck of a time with this as well.

  • Currently I have a separate Google account created and share each my own and my wife’s location with this account (worth noting I do NOT have 2FA on this account - and further that this is the account I’ve setup in configuration.yaml)
  • I downloaded a copy of firefox and installed the cookie getter extension (per instructions here: https://www.home-assistant.io/components/google_maps/ )
  • I logged into google w/ the ‘separate’ google account and went to maps.google.com in Firefox.
  • I then used the extension to download the ‘google.com’ cookies.
  • I then saved this file per the instructions and copied into my config directory on my NUC running HA
  • I then rebooted and it came back ok

Fingers crossed that 1) this keeps working for me and 2) that it works for you too!

6 Likes

Not sure incognito mode is a good thing to use here. By definition, doesn’t that prevent the creation of cookies (so nothing useful to save to the file)??? I’m no browser expert, but it just seems that’s not going to get you what you want.

Me neither but I thought it behaved exactly as normal, it just didn’t save anything when it closed it’s session. Be that as it may it didn’t work for a second time so I’m going to try the Firefox route…

Well… surprise, surprise using Firefox worked!! (I should have listened to @JB_Marchetti at the beginning!)

I did download all cookies though not just google.com and I seem to have one from doubleclick. net. And all I did was go to google maps!!!

I’ll try again just downloading the google.com ones…

Thanks everyone.

2 Likes

FWIW, it worked on Chrome for me, even with an account that uses 2FA. Not sure why you ran into trouble, but I’ve been noticing many people having problems with this recently. Who knows!

I suspect no-one! :slight_smile:
Oh well, that’s 2 hours of my life I’ll never get back, but at least I have Firefox on my PC now. And I’ve been reading a lot of good things about it recently, privacy-wise. Maybe I’ll give it a go…

I just did an experiment. I opened a Chrome incognito window on a freshly installed VM (and just for grins made sure all history, including any cookies, were deleted.) I went to the Google Maps site and logged in. I clicked on the cookies.txt icon and it said there were no cookies for google.com and only offered to download “all cookies”, which I did. The file was basically empty (only comment lines.) So, maybe it really won’t work with a Chrome incognito browser.

1 Like

Well, I just had to go through the process to get the cookie file again.
Is it going to be a regular requirement?

Goodmorning everyone
I hung up following the guide to integrate the tracking on google maps but I can’t make it work. I have the following error:

2020-05-07 15:28:10 ERROR (SyncWorker_1) [homeassistant.components.google_maps.device_tracker] The cookie file provided does not provide a valid session. Please create another one and try again.
2020-05-07 15:28:11 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform legacy

I logged in google chrome with the second account, went to the google maps application and with the addon export cookies.txt I downloaded the cookies.txt file. I renamed it like this:

.google_maps_location_sharing.cookies.pippo_pluto_gmail_com

and I copied it to the homehassistant folder (I have hassio on docker on synology server) where there are also the configuration.yaml, script.yaml files. I entered the following code in configuration.yaml:

device_tracker:
  - platform: google_maps
    username: [email protected]

Then I rebooted several times, but it doesn’t work. In the log I have that error and in the known_devices.yaml file I have nothing about google maps.

Please can someone help me?

Thanks so much.

With best regards

Andrea

The problem I faced was the “.txt” was still there on the file.
Make sure you see the .txt and remove it. It’s a setting in Windows since win 7 I believe to not show the extension of known file formats.
Make sure you change that setting

Hi Hellis81, thanks for reply but the file doesn’t has .txt i’m sure because the type of file is “pippo_pluto_gmail_com” and not “file TXT”. I see that in the windows 7 directory.

thanks

hai risolto?

Ciao, no, ma ho abbandonato l’uso di google maps, questo sistema alla fine non faceva per me.

But it looks like the number of requests to google is limited… Response code: 429

For anybody coming back to this issue, it worked fine for me in firefox (not private mode) by grabbing the google.com cookies and make sure you do not save the cookies at TXT type!! Change the type to any before clicking save.

2 Likes