hangups icon indicating copy to clipboard operation
hangups copied to clipboard

Failed to find form '#gaia_loginform' in page

Open ghost opened this issue 7 years ago • 5 comments

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 "[email protected]" 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: [email protected]
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

ghost avatar Sep 26 '16 16:09 ghost

Looks like Google is prompting you for something before your password. Can you try signing in here using your browser and see what happens?

tdryer avatar Sep 27 '16 02:09 tdryer

Same issue here. I know for a fact that Google is indeed presenting a different login page. That's how federated login works, and my org uses it. I guess I will have to reverse-engineer our own login page.

If I do dequis' approach, it can get the token, but I obviously have to go back to the old code to use it.

I tried to use the link above to extract the token from the cookie as @dequis suggested, but when I do that, and paste it into a refresh_token.txt, I get the following:

INFO:main:Authenticating with refresh token INFO:main:Loading refresh_token from 'refresh_token.txt' INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): accounts.google.com DEBUG:requests.packages.urllib3.connectionpool:"POST /o/oauth2/token HTTP/1.1" 400 None INFO:main:Failed to authenticate using refresh token: Token request failed: 400 Client Error: Bad Request INFO:main:Authenticating with credentials ....

and then I'm just back to the broken login approach.

djacobow avatar Oct 18 '16 00:10 djacobow

i'm just simply getting "Login failed (Failed to find form '#gaia_loginform' in page)"

no idea why.

aaronbond avatar Nov 17 '16 00:11 aaronbond

Same issue here w/ federated login through Microsoft Azure. Receiving error message "Login failed (Failed to find form '#gaia_loginform' in page)".

@tdryer, attempting to use OAuth link you provided results in a stalled loading screen (attached) after a successful login.

error

zhelding avatar Jun 19 '17 16:06 zhelding

any word on this. Getting the same thing @zhelding is getting.

the logs show that if finds gaia_loginform on the first page, then it does a POST and a GET (both successful) and tries to login again at:

https://accounts.google.com/signin/challenge/pwd/2

This page has the forms ['challenge', None, None] which is indeed what is at that page when you inspect the source.

I've tried the manual inspect token and save method, and I've tried source version 0.4.3 still no joy. To bad, I would love to try this great program (despite what the no-proper-risk-assessment, not-all-things-considered, rule-worshiping pedants chanting 'shut this down' say)

jpmorris avatar Aug 05 '17 01:08 jpmorris