Google location sharing cookies issue

So I had a working presence detection setup using Google Location Sharing, but I decided to switch to a different Google user for this in Home assistant. I entered the new credentials in configuration.yaml, but it wouldn’t update properly. I then deleted the .google_maps_location_sharing.cookies file, and it still won’t work.
In my log file, I see the following:
“locationsharinglib.locationsharinglibexceptions.InvalidCookies: The cookies provided do not provide a valid session.Please authenticate normally and save a valid session again”

What further steps can I take to troubleshoot this? Are there any other cookie files that I can remove to wipe the old account authorization further?

More information:
I narrowed down the issue to locationsharinglib. I can authenticate using get-maps-cookies just fine for the original Google user account that I had been using, but I am unable to authenticate for any other user on my GSuite domain besides that one. Any other account results in a NoExpectedFormOption error in get-maps-cookies. None of the accounts are set up for 2FA.

I also opened a bug report for locationsharinglib on github about this, but I was hoping someone here may have run into the same issue.

Have a look here, this is what solved it for me.

edit

Sorry, didn’t read, your second post, and skim read the first one, have you tried doing it manually though like in the steps outlined in the link above.

Thanks!
I did use the steps in the library usage link, and was able to authenticate the original user…still no luck with the new user that I’m trying to authenticate.
The library developer responded with a few more steps to try also, but it sounds like the bottom line is that once Google flags your login as ‘suspicious’, there’s not much you can do to reverse that. Playing around with the user agent at this point to see if I can trick Google into letting it through.

Hi all, I have created an alpha of a cookiegetter project that drives a browser through selenium and saves the cookies. Please look at https://github.com/costastf/mapscookiegettercli/blob/master/USAGE.rst for usage (it is quite simple :slight_smile: ) and report issues at the tracker. I have added this message in a few places trying to get to everybody having had issues with the locationsharingib but please if you try this and it works for you try to reach out to people that might have issues to let them know.

1 Like