costastf / locationsharinglib

A library to retrieve coordinates from an google account that has been shared locations of other accounts.
MIT License
170 stars 29 forks source link

Can't get data with authuser=2 #94

Closed lufton closed 2 years ago

lufton commented 2 years ago

I noticed that my Home Assistant integration that uses you lib does not provide complete information about users that shared location with me. I started to investigate (debugging with VS Code, sniffing with Fiddler) and it looks like authuser with value of 2 doesn't work for me. I found that authuser=5 does work. You can even see, that browser send request with that parameter set to 5. I'm confused! Do you have an idea of what that parameter means and how to get it before sending the request? If there is no quick solution, would it be possible to pass this value as parameter in Service constructor (with default value of 2) so users will be able to specify this manually? image

P.S. I'm in Ukraine (ru-UA)

lufton commented 2 years ago

Okay I kind of figured out what was my problem. So the problem was that I started new incognito window of Chrome (regular window has 5 active accounts) and exported cookies with Get cookies.txt extension. First of all I noticed that my cookies had both google.com and google.com.ua. Witch is strange as url in incognito browser was www.google.com. Also when I tried to switch authuser from 0 up to 5 I found out that with some of this values I receive data from other account even that I got this cookies with incognito mode. Than I just installed Firefox and did the same with Export Cookies extension (selected google.com and didn't check Prefix HttpOnly cookies) and that did the trick! Eventually my tracking account was number 5 among all other accounts. But I still can't understand why this parameter should be 2 if provided cookies doesn't contains any information about other users.

costastf commented 2 years ago

Interesting finding. As you can understand it is not clear what those parameters mean but we can try to guess. Not sure if it is worth the trouble to try to do that though once you have your stuff working as expected.

costastf commented 2 years ago

Shall we close this?

lufton commented 2 years ago

Shall we close this?

Yes, you are welcome! Thanks for you work!

costastf commented 2 years ago

Well, you did all the work 🙂