cevoaustralia / aws-google-auth

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

Random errors: AttributeError: 'NoneType' object has no attribute 'get' #90

Closed max-rocket-internet closed 5 years ago

max-rocket-internet commented 6 years ago
Open the Google App, and tap 'Yes' on the prompt to sign in ...
Traceback (most recent call last):
  File "/Users/max.williams/Library/Python/3.6/lib/python/site-packages/aws_google_auth/google.py", line 259, in parse_saml
    'name': 'SAMLResponse'
AttributeError: 'NoneType' object has no attribute 'get'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/aws-google-auth", line 11, in <module>
    sys.exit(main())
  File "/Users/max.williams/Library/Python/3.6/lib/python/site-packages/aws_google_auth/__init__.py", line 226, in main
    cli(cli_args)
  File "/Users/max.williams/Library/Python/3.6/lib/python/site-packages/aws_google_auth/__init__.py", line 65, in cli
    process_auth(args, config)
  File "/Users/max.williams/Library/Python/3.6/lib/python/site-packages/aws_google_auth/__init__.py", line 187, in process_auth
    saml_xml = google_client.parse_saml()
  File "/Users/max.williams/Library/Python/3.6/lib/python/site-packages/aws_google_auth/google.py", line 263, in parse_saml
    'Could not find SAML response, check your credentials')
RuntimeError: Could not find SAML response, check your credentials

Any idea?

stevemac007 commented 6 years ago

I believe this happens when you are too slow to click yes, I get this too and started working on debugging it recently.

max-rocket-internet commented 6 years ago

Too slow? It was about 2 seconds at most.

stevemac007 commented 6 years ago

I see this when I am too slow, but there may very well be other reasons this occurs. I'm looking at adding some sort of option to dump the HTML for better debugging.

This whole library has been reverse engineered from the pages as there is no documented API for the google auth workflow - they may have changed things too.

max-rocket-internet commented 6 years ago

With my error, it's definitely not due to being slow. I got the error repeatedly while I have the phone in my hand and clicking "yes" immediately.

This whole library has been reverse engineered from the pages

Yes, I see you are using beautifulsoup, such a cool tool but a pain to use. Respect 😁

stevemac007 commented 6 years ago

I've got a build locally that captures the output from all pages to try and help debug these type of issues - I'll clean it up and add CLI flags to conditionally turn it on for debugging and push a PR soon.

max-rocket-internet commented 6 years ago

Great, sounds like a good idea, Steve.

stevemac007 commented 6 years ago

MR #94 is the first crack at helping with this.

I've just released 0.0.27 and will continue to look at #94 to see if it covers the right scenarios.

max-rocket-internet commented 6 years ago

OK so I wait for that PR to be merged and a new release and then I'll update this issue with the output.

stevemac007 commented 5 years ago

@max-rocket-internet did you get any issues since 0.0.27? otherwise can we call this one resolved?

max-rocket-internet commented 5 years ago

Nope, all good. Thanks Steve!