ha-google-home icon indicating copy to clipboard operation
ha-google-home copied to clipboard

Can't Authenticate

Open trikerman opened this issue 2 years ago • 152 comments

Describe the bug

I can't authenticate using user/pass (in account without 2FA) neither using app password (in account with 2FA).

image

Version of the integration

If you are unsure about the version check the github release here.

v1.9.14 (Through HACS) HomeAssistant 2022.8.6 (docker) $ docker exec -it homeassistant pip freeze | grep glocaltoken glocaltokens==0.6.7

Logs

// Logs using user/pass in account witout 2FA

2022-08-26 00:50:26.942 DEBUG (MainThread) [glocaltokens.client] Initializing new GLocalAuthenticationTokens instance.
2022-08-26 00:50:26.942 DEBUG (MainThread) [glocaltokens.client] Set GLocalAuthenticationTokens client access_token, homegraph, access_token_date and homegraph_date to None
2022-08-26 00:50:26.942 DEBUG (MainThread) [glocaltokens.client] Set GLocalAuthenticationTokens client username to "b******************", password to "n*******", master_token to "" and android_id to 
2022-08-26 00:50:26.943 DEBUG (SyncWorker_8) [glocaltokens.client] There is no stored master_token, logging in using username and password
2022-08-26 00:50:26.944 DEBUG (SyncWorker_8) [glocaltokens.client] There is no stored android_id, generating a new one
2022-08-26 00:50:26.944 DEBUG (SyncWorker_8) [glocaltokens.client] Generating android id...
2022-08-26 00:50:26.944 DEBUG (SyncWorker_8) [glocaltokens.client] Generated android id: 2840ff782c******
2022-08-26 00:50:27.195 ERROR (SyncWorker_8) [glocaltokens.client] [!] Could not get master token.
2022-08-26 00:50:27.196 DEBUG (SyncWorker_8) [glocaltokens.client] Request response: {'Error': 'BadAuthentication'}
2022-08-26 00:50:27.199 ERROR (MainThread) [custom_components.google_home] 

// Logs using app password in account with 2FA (the same)

2022-08-26 00:53:51.381 DEBUG (MainThread) [glocaltokens.client] Initializing new GLocalAuthenticationTokens instance.
2022-08-26 00:53:51.382 DEBUG (MainThread) [glocaltokens.client] Set GLocalAuthenticationTokens client access_token, homegraph, access_token_date and homegraph_date to None
2022-08-26 00:53:51.382 DEBUG (MainThread) [glocaltokens.client] Set GLocalAuthenticationTokens client username to "n****************", password to "j***************", master_token to "" and android_id to 
2022-08-26 00:53:51.387 DEBUG (SyncWorker_3) [glocaltokens.client] There is no stored master_token, logging in using username and password
2022-08-26 00:53:51.387 DEBUG (SyncWorker_3) [glocaltokens.client] There is no stored android_id, generating a new one
2022-08-26 00:53:51.387 DEBUG (SyncWorker_3) [glocaltokens.client] Generating android id...
2022-08-26 00:53:51.387 DEBUG (SyncWorker_3) [glocaltokens.client] Generated android id: 9ee609a70c******
2022-08-26 00:53:51.572 ERROR (SyncWorker_3) [glocaltokens.client] [!] Could not get master token.
2022-08-26 00:53:51.575 DEBUG (SyncWorker_3) [glocaltokens.client] Request response: {'Error': 'BadAuthentication'}
2022-08-26 00:53:51.576 ERROR (MainThread) [custom_components.google_home] 

trikerman avatar Aug 25 '22 23:08 trikerman

I have same issue

kobioneil avatar Aug 28 '22 16:08 kobioneil

Same here

paulpall avatar Sep 16 '22 14:09 paulpall

I cannot get past this screen either.

I enter my email address and app password but always get the same response:

Username/Password is incorrect. If your google account has 2FA enabled please generate app password (https://myaccount.google.com/apppasswords). If authentication still fails refer to https://github.com/leikoilja/ha-google-home#troubleshooting

nckslater avatar Sep 27 '22 15:09 nckslater

same here i have tryede with my 2step autotentic code and password no luck with any

droneman83 avatar Oct 11 '22 19:10 droneman83

Hi, I had this working but I uninstalled it and I have reinstalled it after a while, I can't log in.

I have created an app password, but I get errors.

I'm on: Home Assistant 2022.10.3 Supervisor 2022.10.0 Operating System 9.2 Frontend 20221010.0 - latest I run this on a VM.

I'm running version 1.9.15 of ha_google_home

I got this on the Log:

Este error se originó a partir de una integración personalizada.

Logger: glocaltokens.client
Source: custom_components/google_home/api.py:73
Integration: Google Home (documentation, issues)
First occurred: 10:39:47 (3 occurrences)
Last logged: 10:40:58

[!] Could not get master token.

And this:

Este error se originó a partir de una integración personalizada.

Logger: custom_components.google_home
Source: custom_components/google_home/config_flow.py:65
Integration: Google Home (documentation, issues)
First occurred: 10:39:47 (3 occurrences)
Last logged: 10:40:58

And on the full log:

2022-10-12 10:38:12.024 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration google_home which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

2022-10-12 10:39:47.141 DEBUG (MainThread) [glocaltokens.client] Initializing new GLocalAuthenticationTokens instance.
2022-10-12 10:39:47.141 DEBUG (MainThread) [glocaltokens.client] Set GLocalAuthenticationTokens client access_token, homegraph, access_token_date and homegraph_date to None
2022-10-12 10:39:47.141 DEBUG (MainThread) [glocaltokens.client] Set GLocalAuthenticationTokens client username to "a**********************", password to "y***************", master_token to "" and android_id to
2022-10-12 10:39:47.149 DEBUG (SyncWorker_1) [glocaltokens.client] There is no stored master_token, logging in using username and password
2022-10-12 10:39:47.149 DEBUG (SyncWorker_1) [glocaltokens.client] There is no stored android_id, generating a new one
2022-10-12 10:39:47.149 DEBUG (SyncWorker_1) [glocaltokens.client] Generating android id...
2022-10-12 10:39:47.149 DEBUG (SyncWorker_1) [glocaltokens.client] Generated android id: 3e0d925c5981cc49
2022-10-12 10:39:47.306 ERROR (SyncWorker_1) [glocaltokens.client] [!] Could not get master token.
2022-10-12 10:39:47.308 DEBUG (SyncWorker_1) [glocaltokens.client] Request response: {'Error': 'BadAuthentication'}
2022-10-12 10:39:47.308 ERROR (MainThread) [custom_components.google_home]
2022-10-12 10:40:38.538 DEBUG (MainThread) [glocaltokens.client] Initializing new GLocalAuthenticationTokens instance.
2022-10-12 10:40:38.538 DEBUG (MainThread) [glocaltokens.client] Set GLocalAuthenticationTokens client access_token, homegraph, access_token_date and homegraph_date to None
2022-10-12 10:40:38.538 DEBUG (MainThread) [glocaltokens.client] Set GLocalAuthenticationTokens client username to "a**********************", password to "v***************", master_token to "" and android_id to
2022-10-12 10:40:38.539 DEBUG (SyncWorker_3) [glocaltokens.client] There is no stored master_token, logging in using username and password
2022-10-12 10:40:38.539 DEBUG (SyncWorker_3) [glocaltokens.client] There is no stored android_id, generating a new one
2022-10-12 10:40:38.539 DEBUG (SyncWorker_3) [glocaltokens.client] Generating android id...
2022-10-12 10:40:38.539 DEBUG (SyncWorker_3) [glocaltokens.client] Generated android id: 2f17c0f09f04cbab
2022-10-12 10:40:38.730 ERROR (SyncWorker_3) [glocaltokens.client] [!] Could not get master token.
2022-10-12 10:40:38.731 DEBUG (SyncWorker_3) [glocaltokens.client] Request response: {'Error': 'BadAuthentication'}
2022-10-12 10:40:38.731 ERROR (MainThread) [custom_components.google_home]
2022-10-12 10:40:57.917 DEBUG (MainThread) [glocaltokens.client] Initializing new GLocalAuthenticationTokens instance.
2022-10-12 10:40:57.917 DEBUG (MainThread) [glocaltokens.client] Set GLocalAuthenticationTokens client access_token, homegraph, access_token_date and homegraph_date to None
2022-10-12 10:40:57.917 DEBUG (MainThread) [glocaltokens.client] Set GLocalAuthenticationTokens client username to "a***********************", password to "%****************", master_token to "" and android_id to
2022-10-12 10:40:57.917 DEBUG (SyncWorker_3) [glocaltokens.client] There is no stored master_token, logging in using username and password
2022-10-12 10:40:57.917 DEBUG (SyncWorker_3) [glocaltokens.client] There is no stored android_id, generating a new one
2022-10-12 10:40:57.917 DEBUG (SyncWorker_3) [glocaltokens.client] Generating android id...
2022-10-12 10:40:57.918 DEBUG (SyncWorker_3) [glocaltokens.client] Generated android id: d965db2f3fd61914
2022-10-12 10:40:58.038 ERROR (SyncWorker_3) [glocaltokens.client] [!] Could not get master token.
2022-10-12 10:40:58.039 DEBUG (SyncWorker_3) [glocaltokens.client] Request response: {'Error': 'BadAuthentication'}
2022-10-12 10:40:58.039 ERROR (MainThread) [custom_components.google_home]

Fonsos avatar Oct 12 '22 13:10 Fonsos

Same issue here too

revellion avatar Nov 12 '22 13:11 revellion

Today I've tried again and I have the integration working fine with my all my Google devices.

As I can remember right now I didn't change anything so I don't know what could be happening, maybe was on Google's side.

Fonsos avatar Dec 01 '22 09:12 Fonsos

I'm having exactly the same problem, both with a 2FA-enabled account or with an account without 2FA.

2022-12-05 07:29:04.072 ERROR (SyncWorker_7) [glocaltokens.client] [!] Could not get master token.
2022-12-05 07:29:04.080 ERROR (MainThread) [custom_components.google_home] 

davefx avatar Dec 05 '22 06:12 davefx

+1 not working here as well

ptaudio avatar Dec 17 '22 15:12 ptaudio

+1 also not working for me, failing getting the master token. I have uninstalled the integration as it seems it fixed the problem for another user (#623) but it didn't work for me.

From indications in #95, the versions of modules in my installation are:

bash-5.1# pip freeze |pip freeze | grep 'requests\|glocaltokens\|urllib3\|chardet\|gpsoauth'
cchardet==2.1.7
glocaltokens==0.6.8
gpsoauth==1.0.2
requests==2.28.1
requests-file==1.5.1
requests-futures==1.0.0
requests-oauth==0.4.1
requests-oauthlib==1.3.1
requests-toolbelt==0.10.1
urllib3==1.26.8

And DEFAULT_CIPHERS search (I don't know if this is still relevant):

bash-5.1# grep -R "DEFAULT_CIPHERS" /usr/local/lib/python3.10/site-packages
/usr/local/lib/python3.10/site-packages/urllib3/util/ssl_.py:DEFAULT_CIPHERS = ":".join(
/usr/local/lib/python3.10/site-packages/urllib3/util/ssl_.py:    context.set_ciphers(ciphers or DEFAULT_CIPHERS)
grep: /usr/local/lib/python3.10/site-packages/urllib3/util/__pycache__/ssl_.cpython-310.pyc: binary file matches
grep: /usr/local/lib/python3.10/site-packages/urllib3/contrib/__pycache__/securetransport.cpython-310.pyc: binary file matches
/usr/local/lib/python3.10/site-packages/urllib3/contrib/securetransport.py:# This is our equivalent of util.ssl_.DEFAULT_CIPHERS, but expanded out to
/usr/local/lib/python3.10/site-packages/urllib3/contrib/securetransport.py:        util.ssl_.DEFAULT_CIPHERS, at least as supported by macOS. This is done
/usr/local/lib/python3.10/site-packages/urllib3/contrib/securetransport.py:        if ciphers != util.ssl_.DEFAULT_CIPHERS:
/usr/local/lib/python3.10/site-packages/gpsoauth/__init__.py:        context.set_ciphers(ssl_.DEFAULT_CIPHERS)
grep: /usr/local/lib/python3.10/site-packages/gpsoauth/__pycache__/__init__.cpython-310.pyc: binary file matches
/usr/local/lib/python3.10/site-packages/botocore/httpsession.py:    PROTOCOL_TLS, DEFAULT_CIPHERS,
/usr/local/lib/python3.10/site-packages/botocore/httpsession.py:    context.set_ciphers(ciphers or DEFAULT_CIPHERS)
grep: /usr/local/lib/python3.10/site-packages/botocore/__pycache__/httpsession.cpython-310.pyc: binary file matches
/usr/local/lib/python3.10/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/ssl_.py:DEFAULT_CIPHERS = ':'.join([
/usr/local/lib/python3.10/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/ssl_.py:        context.set_ciphers(ciphers or DEFAULT_CIPHERS)
grep: /usr/local/lib/python3.10/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/__pycache__/ssl_.cpython-310.pyc: binary file matches
/usr/local/lib/python3.10/site-packages/aemet_opendata/interface.py:        urllib3.util.ssl_.DEFAULT_CIPHERS = "ALL:@SECLEVEL=1"
grep: /usr/local/lib/python3.10/site-packages/aemet_opendata/__pycache__/interface.cpython-310.pyc: binary file matches
/usr/local/lib/python3.10/site-packages/httpx-0.23.1.dist-info/METADATA:- Use urllib3's `DEFAULT_CIPHERS` for the `SSLConfig` object. (Pull #100)
/usr/local/lib/python3.10/site-packages/httpx/_config.py:DEFAULT_CIPHERS = ":".join(
/usr/local/lib/python3.10/site-packages/httpx/_config.py:        context.set_ciphers(DEFAULT_CIPHERS)
grep: /usr/local/lib/python3.10/site-packages/httpx/__pycache__/_config.cpython-310.pyc: binary file matches
/usr/local/lib/python3.10/site-packages/pip/_vendor/urllib3/util/ssl_.py:DEFAULT_CIPHERS = ":".join(
/usr/local/lib/python3.10/site-packages/pip/_vendor/urllib3/util/ssl_.py:    context.set_ciphers(ciphers or DEFAULT_CIPHERS)
grep: /usr/local/lib/python3.10/site-packages/pip/_vendor/urllib3/util/__pycache__/ssl_.cpython-310.pyc: binary file matches
grep: /usr/local/lib/python3.10/site-packages/pip/_vendor/urllib3/contrib/__pycache__/securetransport.cpython-310.pyc: binary file matches
/usr/local/lib/python3.10/site-packages/pip/_vendor/urllib3/contrib/securetransport.py:# This is our equivalent of util.ssl_.DEFAULT_CIPHERS, but expanded out to
/usr/local/lib/python3.10/site-packages/pip/_vendor/urllib3/contrib/securetransport.py:        util.ssl_.DEFAULT_CIPHERS, at least as supported by macOS. This is done
/usr/local/lib/python3.10/site-packages/pip/_vendor/urllib3/contrib/securetransport.py:        if ciphers != util.ssl_.DEFAULT_CIPHERS:

txelu avatar Dec 28 '22 09:12 txelu

I tried again, with freshly generated app password and also with my actual google password and still getting BadAuthentication error. I tried with the full email and also with the user name, with the same results everytime:

2023-01-01 12:30:33.927 DEBUG (MainThread) [glocaltokens.client] Initializing new GLocalAuthenticationTokens instance.
2023-01-01 12:30:33.928 DEBUG (MainThread) [glocaltokens.client] Set GLocalAuthenticationTokens client access_token, homegraph, access_token_date and homegraph_date to None
2023-01-01 12:30:33.928 DEBUG (MainThread) [glocaltokens.client] Set GLocalAuthenticationTokens client username to "j************************", password to "f***************", master_token to "" and android_id to
2023-01-01 12:30:33.930 DEBUG (SyncWorker_1) [glocaltokens.client] There is no stored master_token, logging in using username and password
2023-01-01 12:30:33.931 DEBUG (SyncWorker_1) [glocaltokens.client] There is no stored android_id, generating a new one
2023-01-01 12:30:33.931 DEBUG (SyncWorker_1) [glocaltokens.client] Generating android id...
2023-01-01 12:30:33.931 DEBUG (SyncWorker_1) [glocaltokens.client] Generated android id: 98676eed7168a414
2023-01-01 12:30:34.199 ERROR (SyncWorker_1) [glocaltokens.client] [!] Could not get master token.
2023-01-01 12:30:34.204 DEBUG (SyncWorker_1) [glocaltokens.client] Request response: {'Error': 'BadAuthentication'}

Any suggestions?

txelu avatar Jan 01 '23 11:01 txelu

@txelu, can you try getting the master token using the underlying glocaltokens package? You will find an example on how to do that in it's repo. Just so we understand if it works in isolation for you to load master token for your account

leikoilja avatar Jan 02 '23 07:01 leikoilja

I tried the sample code. but i get the same error there. that ican't get a master token. I wonder if it's something on Googles side blocking?

revellion avatar Jan 02 '23 10:01 revellion

most likely it is. We were unable to replicate it when previously trying. It seems to be selective issue for some users. Most likely it's some sort of validation/issue on google side of things. Could be anything from your location, android device id, account settings and so much more :/ Since API is reverse engineered there is also no support from google on this matter :/

leikoilja avatar Jan 02 '23 12:01 leikoilja

The example of globaltokens didn't work for me either. I tried with two different google accounts, one with 2FA (main and application passwords tested) and the other one without 2FA (main password used). I got the same "BadAuthentication" error on every attempt.

txelu avatar Jan 02 '23 19:01 txelu

@revellion & @txelu, since we can't replicate the issue in our conditions, would you be interested in trying a few various things to see if google might be flagging your accounts somewhat? A quick thought:

  • We create a shared test environment (same glocaltokens and underlying package versions). Plus we create a shared test google account that you and I can both test on. You try getting the token with that test account (probably see BadAuthentication) and I try the same. We can try to see if the geographical location does anything. (possibly the same can be tested using VPN?)

leikoilja avatar Jan 03 '23 07:01 leikoilja

That sounds like an interesting idea.

Den tis 3 jan. 2023 08:40Ilja Leiko @.***> skrev:

@revellion https://github.com/revellion & @txelu https://github.com/txelu, since we can't replicate the issue in our conditions, would you be interested in trying a few various things to see if google might be flagging your accounts somewhat? A quick thought:

  • We create a shared test environment (same glocaltokens and underlying package versions). Plus we create a shared test google account that you and I can both test on. You try getting the token with that test account (probably see BadAuthentication) and I try the same. We can try to see if the geographical location does anything. (possibly the same can be tested using VPN?)

— Reply to this email directly, view it on GitHub https://github.com/leikoilja/ha-google-home/issues/599#issuecomment-1369466660, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC32IUXXSPZ2LHOFSH6XH4LWQPJVDANCNFSM57UZSSPQ . You are receiving this because you were mentioned.Message ID: @.***>

revellion avatar Jan 03 '23 18:01 revellion

Yes, I'm up for it.

txelu avatar Jan 05 '23 08:01 txelu

Great! It will be a bit hard to test with 2FA since it's only one of us who can have it at the time and you might require verification code sent to my mobile (if so, please email me to [email protected] and we take it case by case) 😅

i have just setup a new google account with no 2FA for now. Login: [email protected], password: C57Lb9kdHdDLi8zYwuv. Set those in glocaltokens in file get_tokens.py for the test and then run poetry run python example/get_tokens.py.

I have just tested it myself:

  • i m located in Sweden
  • no 2FA enabled, using login and password: I get the master token perfectly fine
  • 2FA enabled, using login and password: get NeedsBrowser error when getting master token
  • 2FA enabled, using app password: I get the master token perfectly fine
  • Cleanup: I have remove 2FA auth from the account and removed my app password

Please test it out as well if that works for you, following the same steps above. What's interesting to look as well is, check what device_id=android_id the client generates for you. You can add a line print("[*] Android device ID", client.android_id) after client is initiated in examples/get_tokens.py file. The device_id that it generated for me above was caa87f68ec932820. I wonder if there might be some device IDs generated that are rejected by google servers 🤔

leikoilja avatar Jan 05 '23 09:01 leikoilja

Ran the get_tokens.py script. and it failed.

DEBUG:glocaltokens.client:Initializing new GLocalAuthenticationTokens instance. DEBUG:glocaltokens.client:Set GLocalAuthenticationTokens client access_token, homegraph, access_token_date and homegraph_date to None DEBUG:glocaltokens.client:Set GLocalAuthenticationTokens client username to "h***********************", password to "C******************", master_token to "" and android_id to DEBUG:glocaltokens.client:There is no stored master_token, logging in using username and password DEBUG:glocaltokens.client:There is no stored android_id, generating a new one DEBUG:glocaltokens.client:Generating android id... DEBUG:glocaltokens.client:Generated android id: 50c00294a2fa270c ERROR:glocaltokens.client:[!] Could not get master token. DEBUG:glocaltokens.client:Request response: {'Error': 'BadAuthentication'} [*] Master token None DEBUG:glocaltokens.client:There is no access_token stored, or it has expired, getting a new one... DEBUG:glocaltokens.client:There is no stored master_token, logging in using username and password ERROR:glocaltokens.client:[!] Could not get master token. DEBUG:glocaltokens.client:Request response: {'Error': 'BadAuthentication'} DEBUG:glocaltokens.client:Unable to obtain master token.

[*] Access token (lives 1 hour) None

[] Google devices local authentication tokens DEBUG:glocaltokens.client:Initializing models list if empty... DEBUG:glocaltokens.client:Getting homegraph... DEBUG:glocaltokens.client:There is no stored homegraph, or it has expired, getting a new one... DEBUG:glocaltokens.client:There is no access_token stored, or it has expired, getting a new one... DEBUG:glocaltokens.client:There is no stored master_token, logging in using username and password ERROR:glocaltokens.client:[!] Could not get master token. DEBUG:glocaltokens.client:Request response: {'Error': 'BadAuthentication'} DEBUG:glocaltokens.client:Unable to obtain master token. DEBUG:glocaltokens.client:[GRPC] Unable to obtain access token. DEBUG:glocaltokens.client:Failed to fetch homegraph [] Google devices "[]"

revellion avatar Jan 05 '23 15:01 revellion

@revellion, that's interesting. It's the same account for both of us and it works fine for me and does not for you. I have even tried with the same android_id as you have got above. We would need more info for you to try recreating it.

  1. Where is your test machine physically located? Are you using any VPNs?
  2. What device are you running your requests from, win, mac, linux?
  3. Did you use poetry(as glocaltokens package does) in the tests above? If so, can you please paste here the output of poetry show?

leikoilja avatar Jan 06 '23 05:01 leikoilja

I made that test and I got the exactly same result than @revellion:

DEBUG:glocaltokens.client:Initializing new GLocalAuthenticationTokens instance.
DEBUG:glocaltokens.client:Set GLocalAuthenticationTokens client access_token, homegraph, access_token_date and homegraph_date to None
DEBUG:glocaltokens.client:Set GLocalAuthenticationTokens client username to "h***********************", password to "C******************", master_token to "" and android_id to 
DEBUG:glocaltokens.client:There is no stored master_token, logging in using username and password
DEBUG:glocaltokens.client:There is no stored android_id, generating a new one
DEBUG:glocaltokens.client:Generating android id...
DEBUG:glocaltokens.client:Generated android id: 65d1a4585b933993
ERROR:glocaltokens.client:[!] Could not get master token.
DEBUG:glocaltokens.client:Request response: {'Error': 'BadAuthentication'}
[*] Master token None
DEBUG:glocaltokens.client:There is no access_token stored, or it has expired, getting a new one...
DEBUG:glocaltokens.client:There is no stored master_token, logging in using username and password
ERROR:glocaltokens.client:[!] Could not get master token.
DEBUG:glocaltokens.client:Request response: {'Error': 'BadAuthentication'}
DEBUG:glocaltokens.client:Unable to obtain master token.

[*] Access token (lives 1 hour) None

[*] Google devices local authentication tokens
DEBUG:glocaltokens.client:Initializing models list if empty...
DEBUG:glocaltokens.client:Getting homegraph...
DEBUG:glocaltokens.client:There is no stored homegraph, or it has expired, getting a new one...
DEBUG:glocaltokens.client:There is no access_token stored, or it has expired, getting a new one...
DEBUG:glocaltokens.client:There is no stored master_token, logging in using username and password
ERROR:glocaltokens.client:[!] Could not get master token.
DEBUG:glocaltokens.client:Request response: {'Error': 'BadAuthentication'}
DEBUG:glocaltokens.client:Unable to obtain master token.
DEBUG:glocaltokens.client:[GRPC] Unable to obtain access token.
DEBUG:glocaltokens.client:Failed to fetch homegraph
[*] Google devices "[]"

I also tried using the android_id it worked for you (caa87f68ec932820), but still failed:

DEBUG:glocaltokens.client:Initializing new GLocalAuthenticationTokens instance.
DEBUG:glocaltokens.client:Set GLocalAuthenticationTokens client access_token, homegraph, access_token_date and homegraph_date to None
DEBUG:glocaltokens.client:Set GLocalAuthenticationTokens client username to "h***********************", password to "C******************", master_token to "" and android_id to c***************
DEBUG:glocaltokens.client:There is no stored master_token, logging in using username and password
ERROR:glocaltokens.client:[!] Could not get master token.
DEBUG:glocaltokens.client:Request response: {'Error': 'BadAuthentication'}
[*] Master token None
DEBUG:glocaltokens.client:There is no access_token stored, or it has expired, getting a new one...
DEBUG:glocaltokens.client:There is no stored master_token, logging in using username and password
ERROR:glocaltokens.client:[!] Could not get master token.
DEBUG:glocaltokens.client:Request response: {'Error': 'BadAuthentication'}
DEBUG:glocaltokens.client:Unable to obtain master token.

[*] Access token (lives 1 hour) None

[*] Google devices local authentication tokens
DEBUG:glocaltokens.client:Initializing models list if empty...
DEBUG:glocaltokens.client:Getting homegraph...
DEBUG:glocaltokens.client:There is no stored homegraph, or it has expired, getting a new one...
DEBUG:glocaltokens.client:There is no access_token stored, or it has expired, getting a new one...
DEBUG:glocaltokens.client:There is no stored master_token, logging in using username and password
ERROR:glocaltokens.client:[!] Could not get master token.
DEBUG:glocaltokens.client:Request response: {'Error': 'BadAuthentication'}
DEBUG:glocaltokens.client:Unable to obtain master token.
DEBUG:glocaltokens.client:[GRPC] Unable to obtain access token.
DEBUG:glocaltokens.client:Failed to fetch homegraph
[*] Google devices "[]"

About the additional info:

  1. My machine is in Spain, not using any VPN.
  2. I'm using Arch Linux with kernel 6.1.2
  3. This is the output of the poetry show command:
astor                 0.8.1     Read/rewrite/write Python ASTs
astroid               2.12.9    An abstract syntax tree for Python with inference support.
asttokens             2.0.5     Annotate AST trees with source code positions
async-timeout         4.0.2     Timeout context manager for asyncio programs
attrs                 21.4.0    Classes Without Boilerplate
backcall              0.2.0     Specifications for callback functions passed in to an API
black                 22.8.0    The uncompromising code formatter.
certifi               2021.10.8 Python package for providing Mozilla's CA Bundle.
cfgv                  3.3.1     Validate configuration and produce human readable error messages.
charset-normalizer    2.0.12    The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet.
click                 8.0.4     Composable command line interface toolkit
codespell             2.2.1     Codespell
decorator             5.1.1     Decorators for Humans
dill                  0.3.4     serialize all of python
distlib               0.3.4     Distribution utilities
executing             0.8.2     Get the currently executing AST node of a frame, and other information
faker                 8.16.0    Faker is a Python package that generates fake data for you.
filelock              3.6.0     A platform independent file lock.
flake8                4.0.1     the modular source code checker: pep8 pyflakes and co
flake8-bugbear        22.8.23   A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.
flake8-comprehensions 3.10.0    A flake8 plugin to help you write better list/set/dict comprehensions.
flake8-simplify       0.19.3    flake8 plugin which checks for code that can be simplified
flake8-use-fstring    1.4       Flake8 plugin for string formatting style.
gpsoauth              1.0.2     A python client library for Google Play Services OAuth.
grpc-stubs            1.24.11   Mypy stubs for gRPC
grpcio                1.51.0    HTTP/2-based RPC framework
grpcio-tools          1.43.0    Protobuf code generator for gRPC
identify              2.4.11    File identification library for Python
idna                  3.3       Internationalized Domain Names in Applications (IDNA)
ifaddr                0.1.7     Cross-platform network interface and IP address enumeration library
iniconfig             1.1.1     iniconfig: brain-dead simple config-ini parsing
ipdb                  0.13.9    IPython-enabled pdb
ipython               8.0.1     IPython: Productive Interactive Computing
isort                 5.10.1    A Python utility / library to sort Python imports.
jedi                  0.18.1    An autocompletion tool for Python that can be used for text editors.
lazy-object-proxy     1.7.1     A fast and thorough lazy object proxy.
matplotlib-inline     0.1.3     Inline Matplotlib backend for Jupyter
mccabe                0.6.1     McCabe checker, plugin for flake8
mock                  4.0.3     Rolling backport of unittest.mock for all Pythons
mypy                  0.961     Optional static typing for Python
mypy-extensions       0.4.3     Experimental type system extensions for programs checked with the mypy typechecker.
mypy-protobuf         3.3.0     Generate mypy stub files from protobuf specs
nodeenv               1.6.0     Node.js virtual environment builder
packaging             21.3      Core utilities for Python packages
parso                 0.8.3     A Python Parser
pathspec              0.9.0     Utility library for gitignore style pattern matching of file paths.
pexpect               4.8.0     Pexpect allows easy control of interactive console applications.
pickleshare           0.7.5     Tiny 'shelve'-like database with concurrency support
platformdirs          2.5.1     A small Python module for determining appropriate platform-specific dirs, e.g. a "user data dir".
pluggy                1.0.0     plugin and hook calling mechanisms for python
pre-commit            2.20.0    A framework for managing and maintaining multi-language pre-commit hooks.
prompt-toolkit        3.0.28    Library for building powerful interactive command lines in Python
protobuf              3.20.3    Protocol Buffers
ptyprocess            0.7.0     Run a subprocess in a pseudo terminal
pure-eval             0.2.2     Safely evaluate AST nodes without side effects
py                    1.11.0    library with cross-python path, ini-parsing, io, code, log facilities
pycodestyle           2.8.0     Python style guide checker
pycryptodomex         3.14.1    Cryptographic library for Python
pyflakes              2.4.0     passive checker of Python programs
pygments              2.11.2    Pygments is a syntax highlighting package written in Python.
pylint                2.15.2    python code static checker
pyparsing             3.0.7     Python parsing module
pytest                7.1.3     pytest: simple powerful testing with Python
python-dateutil       2.8.2     Extensions to the standard Python datetime module
pyyaml                6.0       YAML parser and emitter for Python
requests              2.28.1    Python HTTP for Humans.
setuptools            65.3.0    Easily download, build, install, upgrade, and uninstall Python packages
simplejson            3.18.0    Simple, fast, extensible JSON encoder/decoder for Python
six                   1.16.0    Python 2 and 3 compatibility utilities
stack-data            0.2.0     Extract data from python stack frames and tracebacks for informative displays
text-unidecode        1.3       The most basic Text::Unidecode port
toml                  0.10.2    Python Library for Tom's Obvious, Minimal Language
tomli                 2.0.1     A lil' TOML parser
tomlkit               0.11.0    Style preserving TOML library
traitlets             5.1.1     Traitlets Python configuration system
types-protobuf        3.19.22   Typing stubs for protobuf
typing-extensions     4.1.1     Backported and Experimental Type Hints for Python 3.6+
urllib3               1.26.8    HTTP library with thread-safe connection pooling, file post, and more.
virtualenv            20.13.2   Virtual Python Environment builder
wcwidth               0.2.5     Measures the displayed width of unicode strings in a terminal
wrapt                 1.14.1    Module for decorators, wrappers and monkey patching.
zeroconf              0.47.1    A pure python implementation of multicast DNS service discovery

txelu avatar Jan 06 '23 11:01 txelu

Awesome, thank you @txelu for the detailed info! I can see that there are quite a lot of different package versions between your and my environment. Instead of me manually installing all those, can you please upload here your poetry.lock file so i can try running the test with it as well?

leikoilja avatar Jan 06 '23 12:01 leikoilja

Sure, here it is: poetry.zip

txelu avatar Jan 06 '23 12:01 txelu

@txelu, hmmmm, i have just installed dependencies like your poetry.lock file (except I had to update grpcio to 1.51.1 and grpcio-tools to 1.43.0 because they would not build on my mac m1 arm architecture. All tests with the above credentials passed well.

@txelu, i m afraid there is not much i can do on my end to replicate. do you have a chance to test the same thing on:

  • different environment/pc and/or
  • using some VPN to trick your location

leikoilja avatar Jan 10 '23 13:01 leikoilja

Hmm dunno if Native ipv6 bugs up something that maybe use ip in the token?

Den tis 10 jan. 2023 14:58Ilja Leiko @.***> skrev:

@txelu https://github.com/txelu, hmmmm, i have just installed dependencies like your poetry.lock file (except I had to update grpcio to 1.51.1 and grpcio-tools to 1.43.0 because they would not build on my mac m1 arm architecture. All tests with the above credentials passed well.

@txelu https://github.com/txelu, i m afraid there is not much i can do on my end to replicate. do you have a chance to test the same thing on:

  • different environment/pc and/or
  • using some VPN to trick your location

— Reply to this email directly, view it on GitHub https://github.com/leikoilja/ha-google-home/issues/599#issuecomment-1377324658, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC32IURI4KAU5Q2J5X7DFODWRVTGVANCNFSM57UZSSPQ . You are receiving this because you were mentioned.Message ID: @.***>

revellion avatar Jan 11 '23 13:01 revellion

@revellion, seems like you have some extra experience and knowledge 😅 can you elaborate please?

leikoilja avatar Jan 11 '23 13:01 leikoilja

@txelu, hmmmm, i have just installed dependencies like your poetry.lock file (except I had to update grpcio to 1.51.1 and grpcio-tools to 1.43.0 because they would not build on my mac m1 arm architecture. All tests with the above credentials passed well.

@txelu, i m afraid there is not much i can do on my end to replicate. do you have a chance to test the same thing on:

* different environment/pc
  and/or

* using some VPN to trick your location

We can discard now the location as the cause of the problem. I made the following tests:

  • Using a VPN to get an IP in US made no different in my original configuration, with my own google account nor with the one for testing that you created.
  • Using a VM with Ubuntu 20.04.5 worked with both google accounts. I could even see my home devices in the output when using my account.

txelu avatar Jan 12 '23 10:01 txelu

ou wait, @txelu, so changing the environment to Ubuntu instead of Arch Linux has fixed the issues? And changing the location did nothing basically, right?

leikoilja avatar Jan 12 '23 12:01 leikoilja

Exactly. I ran the script from a Ubuntu VM hosted in that same Arch Linux PC and it worked fine without the VPN.

txelu avatar Jan 12 '23 15:01 txelu