Google hangouts - Invalid Login, please try again

Hi,

I have upgraded from 0.84.5 to 0.86.4. Hangouts has stopped working for me. I have tried to delete integration and add back Configuration - Integrations but still getting “Invalid Login, please try again”. I am sure that credentials are ok.
Info from log:
2019-01-29 14:46:46 INFO (SyncWorker_17) [hangups.auth] Authenticating with refresh token
2019-01-29 14:46:46 INFO (SyncWorker_17) [hangups.auth] Failed to authenticate using refresh token: Refresh token not found
2019-01-29 14:46:46 INFO (SyncWorker_17) [hangups.auth] Authenticating with credentials
2019-01-29 14:46:46 INFO (SyncWorker_17) [hangups.auth] Submitting form on page ‘https://accounts.google.com/ServiceLogin
2019-01-29 14:46:46 INFO (SyncWorker_17) [hangups.auth] Page contains forms: [‘gaia_loginform’]
2019-01-29 14:46:46 INFO (SyncWorker_17) [hangups.auth] Page contains inputs: [None, None, None, None, None, None, None, None, None, ‘profile-information’, ‘session-state’, None, ‘_utf8’, ‘bgresponse’, ‘Email’, ‘Passwd-h
idden’, ‘next’]
2019-01-29 14:46:46 INFO (SyncWorker_17) [hangups.auth] Submitting form on page ‘https://accounts.google.com/signin/v1/lookup
2019-01-29 14:46:46 INFO (SyncWorker_17) [hangups.auth] Page contains forms: [‘gaia_loginform’]
2019-01-29 14:46:46 INFO (SyncWorker_17) [hangups.auth] Page contains inputs: [None, None, None, None, None, None, None, None, None, None, ‘profile-information’, ‘session-state’, ‘_utf8’, ‘bgresponse’, ‘Email-hidden’, ‘P
asswd’, ‘signIn’, None]

Thank you for any help. Michal

1 Like

After few hours of searching and combining steps I found the way to get hangouts working. I hope this will help somebody :slight_smile:

Steps for Docker image on Synology

  1. Create dirs /root/.cache/hangups (there will be generated refresh_token.txt)
  2. Download and run this Python script. It requires hangups to be installed.

From <https://gist.github.com/tdryer/b4d4b5944ac22e3b2f3a9dda53e03e87#file-hangups_manual_login-py>

hangups_manual_login.py

>>>>>

import os, hangups, requests, appdirs

print(‘Open this URL:’)

print(hangups.auth.OAUTH2_LOGIN_URL)

authorization_code = input('Enter oauth_code cookie value: ')

with requests.Session() as session:

session.headers = {‘user-agent’: hangups.auth.USER_AGENT}

access_token, refresh_token = hangups.auth._auth_with_code(

session, authorization_code

)

dirs = appdirs.AppDirs(‘hangups’, ‘hangups’)

token_path = os.path.join(dirs.user_cache_dir, ‘refresh_token.txt’)

hangups.auth.RefreshTokenCache(token_path).set(refresh_token)

>>>>>

root@HA3:~/.cache/hangups# python /root/hangups_manual_login.py

  1. Open the URL provided by the script in your browser.
  2. If prompted, log into your Google account normally.
  3. You should be redirected to a page that says "One moment please…". Copy the oauth_code cookie value set by this page (instructions below for Chrome):

----- Press F12 to open DevTools.
----- Select the "Application" tab.
----- In the sidebar, expand "Cookies" and select https://accounts.google.com.
----- In the cookie list, double click on the value for the oauth_code cookie to select it, and copy the value.

  1. Paste the value back into the script’s prompt and press enter.

From <https://github.com/tdryer/hangups/issues/350>

  1. Add following with your generated refresh_token home assistant config/.storage/core.config_entries

{

"connection_class": "unknown",

"data": {

"email": "[email protected]",

"refresh_token": "your-refresh-token"

},

"domain": "hangouts",

"entry_id": "some-entry-id",

"source": "user",

"title": "[email protected]",

"version": 1

},

  1. Restart HA
4 Likes

Thanks! These steps worked for me.

I’m unable to get Hangouts integration setup.

Does this method work on Hass.io?

Currently on the integration page I get an Unknown error occurred, despite entering my a bot specific Gmail account, password and the oauth code detailed in the component documentation.

UPDATE: Issue seems to be resolved and I’m able to login and setup Hangouts Integration in HomeAssistant 0.93.0

Just want to say thanks to @misak000m for documenting this procedure. As late as version 104 (not certain) I could not get the hangouts integration configured via the popup form presented at the top level.

In my case, I am running hassio running under UNRAID. I can easily drop into the console for the homeassistant container and run the hangups command (NOTE: I did not need to install hangups manually).

Also note that hangups --help will list the location of the refresh_token.txt file. Once I grabbed the token string and tested it via the ‘hangups --manual-login’ login command, i copied the token string into the config file under homeassistant/.storage/core.config_ entries file.

I have used this process three times now with solid results. Only reason I have had to do this multiple times in when moving from hassio on raspberrypi-4 to hassio on docker on ubuntu to hassio on docker on UNRAID.