aws-google-auth icon indicating copy to clipboard operation
aws-google-auth copied to clipboard

AttributeError: 'NoneType' object has no attribute 'get'

Open axlan opened this issue 4 years ago • 19 comments

I'm getting this error after I tap yes on my phone to allow the access

➜  aws-google-auth -S 115297745755 -I C02x4yyeb -p default -a --no-cache -u MY_EMAIL
AWS Region: us-west-2
Google Password:
Please visit the following URL to view your CAPTCHA: https://accounts.google.com/Captcha?v=2&ctoken=AAWk9lSGYtUyQjvELZ8fqND_7rJZEuFhLmcERBbgw1kjyEhmvqHBxbigHlUDhwikBUAi1nSp7ftByXuucicqSQLKBXgYhlLlPr4rC4gGt4WXkzctiFolbN0j7Tdsv2JyGmTwA9rYEoNCbzwUsWlaHg96AghiucmjuIZ8jVtRw4RzCI4yvboHpMF0NHcYJj6VlaxnoBZlnvlK
Captcha (case insensitive): cubscrout
Open the Google App, and tap 'Yes' on the prompt to sign in ...
ERROR:root:'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aws_google_auth/__init__.py", line 79, in cli
    process_auth(args, config)
  File "/usr/local/lib/python3.9/site-packages/aws_google_auth/__init__.py", line 243, in process_auth
    google_client.do_login()
  File "/usr/local/lib/python3.9/site-packages/aws_google_auth/google.py", line 325, in do_login
    sess = self.handle_prompt(sess)
  File "/usr/local/lib/python3.9/site-packages/aws_google_auth/google.py", line 626, in handle_prompt
    response_page.find('input', {
AttributeError: 'NoneType' object has no attribute 'get'

axlan avatar Feb 10 '21 19:02 axlan

Same issue with:

  • aws-google-auth: 0.0.37 (installed via brew)
  • Python: 3.9.1
  • MacOS: 11.2.1
➜  aws-google-auth -k
Open the Google App, and tap 'Yes' on the prompt to sign in ...
ERROR:root:'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/local/Cellar/aws-google-auth/0.0.37/libexec/lib/python3.9/site-packages/aws_google_auth/__init__.py", line 79, in cli
    process_auth(args, config)
  File "/usr/local/Cellar/aws-google-auth/0.0.37/libexec/lib/python3.9/site-packages/aws_google_auth/__init__.py", line 243, in process_auth
    google_client.do_login()
  File "/usr/local/Cellar/aws-google-auth/0.0.37/libexec/lib/python3.9/site-packages/aws_google_auth/google.py", line 324, in do_login
    sess = self.handle_prompt(sess)
  File "/usr/local/Cellar/aws-google-auth/0.0.37/libexec/lib/python3.9/site-packages/aws_google_auth/google.py", line 619, in handle_prompt
    response_page.find('input', {
AttributeError: 'NoneType' object has no attribute 'get'

Wingjam avatar Feb 13 '21 20:02 Wingjam

Workaround, login with version 0.0.36 using docker

docker run -it -v ~/.aws:/root/.aws cevoaustralia/aws-google-auth:0.0.36 -p default

Wingjam avatar Feb 14 '21 14:02 Wingjam

Rolling back to 0.0.36 worked for me

monkora avatar Feb 15 '21 16:02 monkora

Just ran into this too, I was able to do (using zsh and mac)

sudo pip3 uninstall "aws-google-auth[u2f]"
sudo pip3 install "aws-google-auth[u2f]==0.0.36"

and it's working again

slikk66 avatar Feb 19 '21 23:02 slikk66

I'm installed the 0.0.36 version, but don't work form me.

claudiopablo avatar Apr 12 '22 01:04 claudiopablo

Not working for me either, even with 0.0.36 version chip: m1 macos: 12.3 python 3.9.12

Docker didn't work as well.

maxalves avatar Apr 12 '22 03:04 maxalves

Same problem in here. chip: intel macos: 10.9 phyton: 3.10.14

paulorgl avatar Apr 18 '22 18:04 paulorgl

Hello,

I am getting the same error using: chip: intel macos: 12.3 python: 3.9 or 3.6

I am printing the HTML page that the tool processes to retrieve the challengeId: image

wwalsh-digitary avatar Apr 27 '22 16:04 wwalsh-digitary

same. I get the javascript error too. Tool previously worked fine.

Riyanat avatar Apr 28 '22 17:04 Riyanat

Fix listed here: https://github.com/cevoaustralia/aws-google-auth/commit/d7d70010bac0494a5902e92a3bd7e124611cd6c1

Steps to fix:
=========

Create a patch file from this text, call it aws-google-auth.patch (exclude the surrounding dashes):
--------------------------------------------------------------------
--- /opt/homebrew/lib/python3.9/site-packages/aws_google_auth/google.py	2022-04-27 10:25:42.000000000 +1000
+++ /opt/homebrew/lib/python3.9/site-packages/aws_google_auth/google.py	2022-04-27 10:23:35.000000000 +1000
@@ -264,6 +264,12 @@
         # Update the payload
         payload['Passwd'] = self.config.password
 
+        # Set bg_response in request payload to passwd challenge
+        if self.config.bg_response:
+            payload['bgresponse'] = self.config.bg_response
+
+
+
         # POST to Authenticate Password
         sess = self.post(passwd_challenge_url, data=payload)
--------------------------------------------------------------------


# Check what version you have installed
pip -V && pip3 -V && python -V && aws-google-auth -V

# If aws-google-auth isn't 0.0.37, then install it:
pip uninstall aws-google-auth
pip install   aws-google-auth==0.0.37

# Finally get aws-google-auth path
PATH_TO_PYTHON_PACKAGE=$(pip3 show aws_google_auth|grep "Location"|cut -d " " -f 2)

# Display path
echo $PATH_TO_PYTHON_PACKAGE

# Patch the file using the downloaded .patch file present in ticket DCS-1593
sudo patch $PATH_TO_PYTHON_PACKAGE/aws_google_auth/google.py aws-google-auth.patch

# Check if the patch was applied - this shows the diff between the orig file and patched file
diff $PATH_TO_PYTHON_PACKAGE/aws_google_auth/google.py $PATH_TO_PYTHON_PACKAGE/aws_google_auth/google.py.orig

This fix only worked for aws-google-auth v0.0.37.

wwalsh-digitary avatar May 03 '22 07:05 wwalsh-digitary

Update to aws-google-auth v0.0.38, at least that's what worked for me.

Hey-ItsFizban avatar May 11 '22 13:05 Hey-ItsFizban

Seeing this issue on freshly installed 0.0.38 on python 3.9.12 with an OTP protected account. Also tried downgrading to 0.0.36 and 37. No changes.

The SAML response shows the same javascript message depicted above: "The browser you’re using doesn’t support JavaScript..."

ERROR:root:'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/Users/x/.pyenv/versions/3.9.12/lib/python3.9/site-packages/aws_google_auth/__init__.py", line 79, in cli
    process_auth(args, config)
  File "/Users/x/.pyenv/versions/3.9.12/lib/python3.9/site-packages/aws_google_auth/__init__.py", line 243, in process_auth
    google_client.do_login()
  File "/Users/x/.pyenv/versions/3.9.12/lib/python3.9/site-packages/aws_google_auth/google.py", line 256, in do_login
    passwd_challenge_url = 'https://accounts.google.com' + form.get('action')
AttributeError: 'NoneType' object has no attribute 'get'

scolebrook avatar May 17 '22 19:05 scolebrook

Like mentioned in other issues, did you tried: aws-google-auth --bg-response js_enabled ?

For debugging purpose, also add the following arguments: --save-failure-html -l debug

Wingjam avatar May 17 '22 21:05 Wingjam

@Wingjam Thanks so much. That was it.

scolebrook avatar May 18 '22 12:05 scolebrook

I had the following stacktrace:

ERROR:root:'NoneType' object has no attribute 'find_all'
Traceback (most recent call last):
  File "c:\users\xxx\anaconda3\envs\python\lib\site-packages\aws_google_auth\__init__.py", line 79, in cli
    process_auth(args, config)
  File "c:\users\xxx\anaconda3\envs\python\lib\site-packages\aws_google_auth\__init__.py", line 243, in process_auth
    google_client.do_login()
  File "c:\users\xxx\anaconda3\envs\python\lib\site-packages\aws_google_auth\google.py", line 291, in do_login
    sess = self.handle_captcha(sess, payload)
  File "c:\users\xxx\anaconda3\envs\python\lib\site-packages\aws_google_auth\google.py", line 432, in handle_captcha
    for tag in form.find_all('input'):
AttributeError: 'NoneType' object has no attribute 'find_all'

Upgrading to aws-google-auth v0.0.38 fixed it, as suggested @Hey-ItsFizban

Math2Compute avatar May 20 '22 14:05 Math2Compute

I was able to resolve the issue with the ff cmdline aws-google-auth -I <IDP_ID> -S <SP_ID> -R <region> -d 3600 -u <username/email> --bg-response js_enabled and getting the captcha after this resolved the issue. 😊

Elvis020 avatar Jun 06 '22 17:06 Elvis020

Like mentioned in other issues, did you tried: aws-google-auth --bg-response js_enabled ?

For debugging purpose, also add the following arguments: --save-failure-html -l debug

Thanks, it worked for me

nql6692 avatar Nov 15 '22 07:11 nql6692