Single-factor authentication failing
See original GitHub issueSometime in the last few days, it seems like something has changed on Google’s end that prevents locationsharinglib from successfully authenticating. I’m using the locationsharinglib 3.0.11 with the following small shell script to refresh my cookie file:
#!/srv/hass/bin/python
# -*- coding: utf-8 -*-
import os
import sys
scriptFolder = os.path.dirname(os.path.realpath(__file__))
username = sys.argv[1]
password = sys.argv[2]
currentFolder = os.getcwd()
cookies_file = scriptFolder + "/" + sys.argv[3]
if os.path.isfile(cookies_file):
os.remove(cookies_file)
from locationsharinglib import Service
service = Service(username, password, cookies_file)
for person in service.get_shared_people():
print(person)
print("\n")
It also fails in the exactly the same manner from Home Assistant 0.87.1. All was working last week, the last time I restarted HA.
$ refresh-google-maps-cookies.py 'user@gmail.com' '**********' '.google_maps_location_sharing.cookies'
Traceback (most recent call last):
File "/home/hass/config/refresh-google-maps-cookies.py", line 21, in <module>
service = Service(username, password, cookies_file)
File "/srv/hass/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 366, in __init__
cookies_file=cookies_file)
File "/srv/hass/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 225, in __init__
self._authenticate()
File "/srv/hass/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 263, in _authenticate
self._submit_password()
File "/srv/hass/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 306, in _submit_password
raise InvalidCredentials(body)
locationsharinglib.locationsharinglibexceptions.InvalidCredentials:
I don’t want to post all the response, because it contains personal identifying information, but the response contains “type: FIRST_AUTH_FACTOR” (I only have single-factor authentication), and “INCORRECT_ANSWER_ENTERED”. I’m sure I have the correct password. I’m able to login successfully via a browser. If any other parts of the response are pertinent, I can provide them.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Thanks for spending your time doing this. Just wanted to let you know that your work is appreciated! It helps make sure my porch lights are on when I come home at night 😃
Oh, and if it matters, I’m in Canada, so I guess this issue just started for us.
I have removed the authentication part from locationsharinglib and uploaded version 4 with those changes. I have made a proof of concept project that drives a browser via selenium and saves the cookies in a compatible with locationsharinglib format. If anyone wants to try out the POC and very crud version because they are feeling adventurous you can follow the documentation at the end of the page https://github.com/costastf/mapscookiegettercli/blob/initial-usability/USAGE.rst . This is heavily a work in progress and only works for chrome currently, tested only on Mac (but i guess linux should also work) so please do not start creating issues just yet, unless you also want to contribute. I am planing to clean it up and and make it nicer during the upcoming weekends. I am hoping to have a somewhat properly working version out after the coming weekend supporting chrome for all latest version of Mac, Linux and Windows. Of course if anyone is interested in helping out, all help is welcome!