Repository: tdryer/hangups

Issue #264: Failed to find form '#gaia_loginform' in page
Created: 2016-09-26T16:45:46Z
I can't log in with one of my accounts, but I can with the other one. The one that can login does have the phone authentication login (not two-factor) enabled and is part of Project Fi (if this might make any difference?), but my phone has been turned off when testing and it hasn't seemed to affect it. My email has been replaced by "myemail@gmail.com" for privacy in the log.
INFO:__main__:Authenticating with refresh token
INFO:__main__:Loading refresh_token from 'refresh_token.txt'
INFO:__main__:Failed to load refresh_token: [Errno 2] No such file or directory: 'refresh_token.txt'
INFO:__main__:Failed to authenticate using refresh token: Refresh token not found
INFO:__main__:Authenticating with credentials
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): accounts.google.com
DEBUG:requests.packages.urllib3.connectionpool:"GET /o/oauth2/programmatic_auth?client_id=936475272427.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.google.com%2Faccounts%2FOAuthLogin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email HTTP/1.1" 302 None
DEBUG:requests.packages.urllib3.connectionpool:"GET /ServiceLogin?passive=1209600&continue=https://accounts.google.com/o/oauth2/programmatic_auth?scope%3Dhttps://www.google.com/accounts/OAuthLogin%2Bhttps://www.googleapis.com/auth/userinfo.email%26client_id%3D936475272427.apps.googleusercontent.com%26from_login%3D1%26as%3D873157a4103e377&ltmpl=embedded&oauth=1&sarp=1&scc=1 HTTP/1.1" 200 None
Sign in with your Google account:
Email: myemail@gmail.com
INFO:__main__:Submitting form on page 'https://accounts.google.com/ServiceLogin'
INFO:__main__:Page contains forms: ['gaia_loginform']
INFO:__main__:Page contains inputs: [None, None, None, None, None, None, None, None, 'profile-information', '_utf8', 'bgresponse', 'Email', 'Passwd-hidden', 'next']
DEBUG:requests.packages.urllib3.connectionpool:"POST /AccountLoginInfo HTTP/1.1" 302 721
DEBUG:requests.packages.urllib3.connectionpool:"GET /signin/challenge/pwd/1?continue=https%3A%2F%2Faccounts.google.com%2Fo%2Foauth2%2Fprogrammatic_auth%3Fscope%3Dhttps%3A%2F%2Fwww.google.com%2Faccounts%2FOAuthLogin%2Bhttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%26client_id%3D936475272427.apps.googleusercontent.com%26from_login%3D1%26as%3D873157a4103e377&sarp=1&scc=1&TL=AHnYQLziOYjqrjck0bbQNvw1I1MVldiivrpFBzne-pxNOHC0hhy83gXrqotVJFB2AZnLtxH9WAFwpn4NNNV3K3aQzz932cihVKJn2wsryBqsDVMkMFN7q4pHYvyvDHncVE_XU4zUH-Ypzma06Nam_1bHtICE_fRm1Q%3D%3D HTTP/1.1" 200 None
Password: 
INFO:__main__:Submitting form on page 'https://accounts.google.com/signin/challenge/pwd/1'
INFO:__main__:Page contains forms: ['challenge', None]
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/hangups-0.4.0-py3.5.egg/hangups/auth.py", line 133, in get_auth
__main__.GoogleAuthError: Refresh token not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/hangups-0.4.0-py3.5.egg/hangups/auth.py", line 184, in submit_form
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.5/dist-packages/hangups-0.4.0-py3.5.egg/hangups/auth.py", line 346, in <module>
  File "/usr/local/lib/python3.5/dist-packages/hangups-0.4.0-py3.5.egg/hangups/auth.py", line 65, in get_auth_stdin
  File "/usr/local/lib/python3.5/dist-packages/hangups-0.4.0-py3.5.egg/hangups/auth.py", line 139, in get_auth
  File "/usr/local/lib/python3.5/dist-packages/hangups-0.4.0-py3.5.egg/hangups/auth.py", line 233, in _get_authorization_code
  File "/usr/local/lib/python3.5/dist-packages/hangups-0.4.0-py3.5.egg/hangups/auth.py", line 187, in submit_form
__main__.GoogleAuthError: Failed to find form '#gaia_loginform' in page

Duplicate issue #359: 'Failed to find form {!r} in page'.format(form_selector) hangups.auth.GoogleAuthError: Failed to find form '#gaia_loginform' in page
Created: 2017-09-08T23:34:47Z
I've received this error on two different machines first with a host install, second trying to utilize the docker image.
sleezbox:~/hangoutsbot# uname -a
Linux sleezbox 4.9.32-0-hardened #1-Alpine SMP Fri Jun 16 12:20:58 GMT 2017 x86_64 Linux
sleezbox:~/hangoutsbot# docker --version
Docker version 17.05.0-ce, build v17.05.0-ce
sleezbox:~/hangoutsbot# docker run -it -v $HOME/hob-data-dir:/data hangoutsbot/hangoutsbot -d
23:36:33 INFO config: /root/.local/share/hangupsbot/config.json read
23:36:33 INFO root: memory = /root/.local/share/hangupsbot/memory.json, failsafe = 3, delay = 1
23:36:33 INFO config: /root/.local/share/hangupsbot/memory.json read
23:36:33 INFO requests.packages.urllib3.connectionpool: Starting new HTTPS connection (1): accounts.google.com
Sign in with your Google account:
Email: jusplainmike@gmail.com
Password:
23:36:43 ERROR root: LOGIN FAILED
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/hangups/auth.py", line 132, in get_auth
raise GoogleAuthError("Refresh token not found")
hangups.auth.GoogleAuthError: Refresh token not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/hangups/auth.py", line 176, in submit_form
form = self._page.soup.select(form_selector)[0]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "hangupsbot.py", line 137, in login
cookies = hangups.auth.get_auth_stdin(cookies_path)
File "/usr/local/lib/python3.6/site-packages/hangups/auth.py", line 64, in get_auth_stdin
return get_auth(CredentialsPrompt(), refresh_token_cache)
File "/usr/local/lib/python3.6/site-packages/hangups/auth.py", line 138, in get_auth
session, credentials_prompt
File "/usr/local/lib/python3.6/site-packages/hangups/auth.py", line 221, in _get_authorization_code
browser.submit_form(FORM_SELECTOR, {PASSWORD_SELECTOR: password})
File "/usr/local/lib/python3.6/site-packages/hangups/auth.py", line 179, in submit_form
'Failed to find form {!r} in page'.format(form_selector)
hangups.auth.GoogleAuthError: Failed to find form '#gaia_loginform' in page
23:36:43 ERROR root: Valid login required, exiting
sleezbox:~/hangoutsbot#

Closing comment (2017-09-08T23:44:58Z): Duplicate of #264