Core: Invalid Login For Hangouts When Credentials Are Indeed Valid

Created on 28 Aug 2018  路  15Comments  路  Source: home-assistant/core

Home Assistant release with the issue:

0.77.0b4

Last working Home Assistant release (if known):

0.77.0b1

Operating environment (Hass.io/Docker/Windows/etc.):

venv

Component/platform:

hangouts

https://rc--home-assistant-docs.netlify.com/components/hangouts

Description of problem:

After successfully running the integration in 0.77.0b1 and updating to b4 I attempted to remove and readd the integration and now I get the same UI error from #16181 about invalid login. I had also attempted to restart HA after removing the integration but it was still giving the same error. I also verified that no security alerts were grabbed. I do not have 2fa or anything else enabled on this account.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

n/a setting up component via config entry with correct email and password

Traceback (if applicable):

2018-08-28 13:39:09 INFO (MainThread) [homeassistant.components.http.view] Serving /api/config/config_entries/flow/683d47f8367747ce9eb33f299e7efe43 to 192.168.1.19 (auth: True)
2018-08-28 13:39:10 INFO (SyncWorker_18) [hangups.auth] Authenticating with refresh token
2018-08-28 13:39:10 INFO (SyncWorker_18) [hangups.auth] Failed to authenticate using refresh token: Refresh token not found
2018-08-28 13:39:10 INFO (SyncWorker_18) [hangups.auth] Authenticating with credentials
2018-08-28 13:39:11 INFO (SyncWorker_18) [hangups.auth] Submitting form on page 'https://accounts.google.com/ServiceLogin'
2018-08-28 13:39:11 INFO (SyncWorker_18) [hangups.auth] Page contains forms: ['gaia_loginform']
2018-08-28 13:39:11 INFO (SyncWorker_18) [hangups.auth] Page contains inputs: [None, None, None, None, None, None, None, None, None, 'profile-information', 'session-state', None, '_utf8', 'bgresponse', 'Email', 'Passwd-hidden', 'next']
2018-08-28 13:39:11 INFO (SyncWorker_18) [hangups.auth] Submitting form on page 'https://accounts.google.com/signin/v1/lookup'
2018-08-28 13:39:11 INFO (SyncWorker_18) [hangups.auth] Page contains forms: ['gaia_loginform']
2018-08-28 13:39:11 INFO (SyncWorker_18) [hangups.auth] Page contains inputs: [None, None, None, None, None, None, None, None, None, None, 'profile-information', 'session-state', '_utf8', 'bgresponse', 'Email-hidden', 'Passwd', 'signIn', None]

Additional information:
CC: @hobbypunk90

Reported in beta channel on discord and few users are reporting similar issue

Most helpful comment

You might get an error when opening the URL if you're requesting it via GET. Via POST it should work.

I managed to manually add my Hangouts account:
1) Use the following method to login to hangups: https://github.com/tdryer/hangups/issues/350#issuecomment-323553771
2) Get your refresh token from /home/homeassistant/.cache/hangups/refresh_token.txt
3) Temporarily modify the hangups library to use your refresh token rather than the login you pass. In my case, I edited the file auth.py in the hangups package folder (for me: /srv/homeassistant/lib/python3.5/site-packages/hangups) and changed from:
refresh_token = refresh_token_cache.get()
to
refresh_token = '<YOUR_TOKEN>'
This is definitely not a clean solution and I immediately reverted the changes after logging in....
4) Try to link your account in home-assistant.

All 15 comments

i'm digging though hangups and the problem seams that google asks sometimes for a captcha, that's when we get the problems...
at the moment, the only solution is to write a hint to the doc 馃槥

@hobbypunk90 as expected waiting resolved the issue with the captcha, we should definitely make sure to note this in the documentation and maybe even the release notes?

closing this issue as the docs have now been updated.

I can not login at all. I have waited overnight and it still does not work. Please advice.

Same for me. Have been waiting for more than a week already.

Same for me.. :/

I don't know why, but I think Google asks for a captcha at your systems, the hangups lib we use don't work with captchas.
We can't work around this problem.
Sorry, but I have no idea, how to help you...

Happens for me too with both my GSuite and standard Google accounts. Waited several days and tried several times.

The error log posted (which is the same as my error) reports that Hass.io is attempting to sign into this URL: https://accounts.google.com/signin/v1/lookup but that URL does not appear valid.

Is that perhaps related?

You might get an error when opening the URL if you're requesting it via GET. Via POST it should work.

I managed to manually add my Hangouts account:
1) Use the following method to login to hangups: https://github.com/tdryer/hangups/issues/350#issuecomment-323553771
2) Get your refresh token from /home/homeassistant/.cache/hangups/refresh_token.txt
3) Temporarily modify the hangups library to use your refresh token rather than the login you pass. In my case, I edited the file auth.py in the hangups package folder (for me: /srv/homeassistant/lib/python3.5/site-packages/hangups) and changed from:
refresh_token = refresh_token_cache.get()
to
refresh_token = '<YOUR_TOKEN>'
This is definitely not a clean solution and I immediately reverted the changes after logging in....
4) Try to link your account in home-assistant.

Thanks for the idea! I'm using Hass.io though so I can't SSH into the Hass container and run the *.py file or modify files in the /srv/ directory.

Any idea how else to make this work? I tried several different gmail (both GSuite and regular gmail) and have tried waiting several days at a time but it never works. Also updated to 0.80.3, same issue.

_EDIT: Clarified my environment._

Following all these steps described by senormatanza in the post above, I successfully linked my account in HA hangouts integration. Then reverted the code in auth.py. But on the next HA restart I found the errors in the log. And hangouts integration did not work anymore. It looks like hangups failed on refreshing Hangouts token. HA version 082.1. Virtual env.
When I traced the call it turned out that HA called hangups get_auth without refresh token.
Further research discovered that HA failed to update refresh_token value in the file core.config_entries. After updating that with the obtained value from the script everything worked with the original auth.py

@eaglesvr Would you mind posting example of our refresh_token is supposed to be stored in core.config_entries? I was able to use hangups to login to hangouts but I'm not sure what the syntax for the refresh_token is supposed to be in the core.config_entries file.

Thanks.

Below is hangout's related part of core.config_entries. It was created by HA integration when I linked hangouts account by running manual script. But originally it showed"refresh_token":"null" which I replaced with the value from hangups .cache refresh_token.txt file. This section will be erased at the next HA restart if auth.py code is reverted to the original value and refresh_token is not changed from null to the obtained by the script value
{
"connection_class": "cloud_push",
"data": {
"email": "[email protected]",
"refresh_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"domain": "hangouts",
"entry_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
"source": "user",
"title": "[email protected]",
"version": 1
}

Thanks! That worked for me. I didn't have an entity_id so I left it empty but it seems to still work.

Ugh, I've managed to get that refresh_token.txt, but since I'm running hass.io, I'm unable to access the file system to put the file where it needs to go... I think for hass.io users, we need a way to do the "manual login" method in the HA Hangups component, or even just some way to paste the refresh_token.txt contents into a form somewhere to get it saved correctly....

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arangates picture arangates  路  3Comments

MartinHjelmare picture MartinHjelmare  路  3Comments

i-am-shodan picture i-am-shodan  路  3Comments

piitaya picture piitaya  路  3Comments

missedtheapex picture missedtheapex  路  3Comments