cevoaustralia / aws-google-auth

Provides AWS STS credentials based on Google Apps SAML SSO auth (what a jumble!)
MIT License
537 stars 179 forks source link

Cannot authenticate with Google, won't redirect to challenge page #184

Open james-welly opened 4 years ago

james-welly commented 4 years ago

Have been using the docker image with this repo to authenticate with Google for some time. As of yesterday it stopped working with the following error message:

ERROR:root:'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/build/aws_google_auth/__init__.py", line 78, in cli
    process_auth(args, config)
  File "/build/aws_google_auth/__init__.py", line 242, in process_auth
    google_client.do_login()
  File "/build/aws_google_auth/google.py", line 235, in do_login
    passwd_challenge_url = 'https://accounts.google.com' + form.get('action')
AttributeError: 'NoneType' object has no attribute 'get'

I have removed the image and downloaded the latest version and still get the error. I have also created a virtual environment with the latest python packages and run the following command and still no joy.

aws-google-auth -k -p ${AWS_PROFILE_NAME} -I ${GOOGLE_IDP_ID} -S ${GOOGLE_SP_ID} -R ${AWS_DEFAULT_REGION} --resolve-aliases -q

I have exported the challenge page to html (attached). Everyone else in my organisation is still able to use the repo to authenticate. Any thoughts? It appears to be a similar comments in https://github.com/cevoaustralia/aws-google-auth/issues/160

Screenshot 2020-04-21 at 10 49 56

out2.html.zip

dgcgh commented 4 years ago

I'm seeing a similar error that looks like this: ERROR:root:'NoneType' object has no attribute 'get' Traceback (most recent call last): File "/home/davidgcheney/.local/lib/python3.7/site-packages/aws_google_auth/__init__.py", line 76, in cli process_auth(args, config) File "/home/davidgcheney/.local/lib/python3.7/site-packages/aws_google_auth/__init__.py", line 233, in process_auth google_client.do_login() File "/home/davidgcheney/.local/lib/python3.7/site-packages/aws_google_auth/google.py", line 238, in do_login passwd_challenge_url = 'https://accounts.google.com' + form.get('action') AttributeError: 'NoneType' object has no attribute 'get' Screenshot 2020-04-22 at 12 53 55

I have multple accounts and profiles and strangely this is consistent for one of those accounts while the other one works properly. Guessing it's bot detection, but this is very frustrating.

Zlender commented 4 years ago

I'm seeing same error

ERROR:root:'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/local/Cellar/aws-google-auth/0.0.35/libexec/lib/python3.8/site-packages/aws_google_auth/__init__.py", line 76, in cli
    process_auth(args, config)
  File "/usr/local/Cellar/aws-google-auth/0.0.35/libexec/lib/python3.8/site-packages/aws_google_auth/__init__.py", line 233, in process_auth
    google_client.do_login()
  File "/usr/local/Cellar/aws-google-auth/0.0.35/libexec/lib/python3.8/site-packages/aws_google_auth/google.py", line 235, in do_login
    passwd_challenge_url = 'https://accounts.google.com' + form.get('action')
AttributeError: 'NoneType' object has no attribute 'get'

I can't seem to find a way around it.

tlvince commented 4 years ago

Duplicate of #179

stevemac007 commented 4 years ago

Is this resolved with the latest build 0.0.36 which has the fixed for captcha.

Please let us know if this resolves your issue.

williamcoates commented 4 years ago

My whole team is getting this error with 0.0.36

Screenshot 2020-09-16 at 10 35 59
Frietziek commented 4 years ago

Hello, I'm getting the same problem @james-welly. Do you find any solution to it?

I'm not familiar with the code base of the project, but looking quickly I can see that the problem is here, in google.py file:

        if challenge_page.find('form', {'id': 'gaia_loginform'}):
            form = challenge_page.find('form', {'id': 'gaia_loginform'})
            passwd_challenge_url = form.get('action')
        else:
            # sometimes they serve up a different page
            logging.info("Handling new-style login page")
            form = challenge_page.find('form', {'id': 'challenge'})
            passwd_challenge_url = 'https://accounts.google.com' + form.get('action')

form doesn't get any value. It look like the webscrapping is failing, I'm not sure how to help tough @stevemac007

Frietziek commented 4 years ago

Not sure if it helps someone, but in my case, the problem seem to be that at my company we are using something called MobileIron as second factor authentication with our smarthphone, and when aws-google-auth code is doing this on google.py:

# POST to account login info page, to collect profile and session info
sess = self.post(account_login_url, data=payload)

It is getting this html: image

Which doesn't have the following expected form:

form = challenge_page.find('form', {'id': 'challenge'})
passwd_challenge_url = 'https://accounts.google.com' + form.get('action')

So it breaks:

ERROR:root:'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/aws_google_auth/__init__.py", line 78, in cli
    process_auth(args, config)
  File "/usr/local/lib/python3.8/dist-packages/aws_google_auth/__init__.py", line 242, in process_auth
    google_client.do_login()
  File "/usr/local/lib/python3.8/dist-packages/aws_google_auth/google.py", line 235, in do_login
    passwd_challenge_url = 'https://accounts.google.com' + form.get('action')
AttributeError: 'NoneType' object has no attribute 'get'
rama3319 commented 2 years ago

My whole team started getting below error with aws-google-auth. We tried resetting cookies, uninstalled & installed aws-google-auth but did not help. Can some please shed some light on it. It was working fine until yesterday.

image
rmirandarj commented 2 years ago

My whole team started getting below error with aws-google-auth. We tried resetting cookies, uninstalled & installed aws-google-auth but did not help. Can some please shed some light on it. It was working fine until yesterday. image

I was getting the same problem, but I just added this flag --bg-response js_enabled, running the latest version of aws-google-auth (0.0.38).

aws-google-auth --bg-response js_enabled