saml2aws: Errors using GoogleApps - error loading first page

When using the GoogleApps provider with saml2aws, I’m getting a error:

Error authenticating to IdP.: error loading first page: failed to build login form data: could not find any forms matching the provided IDs An error occurred

Looking at the code I see that saml2aws is looking for a form with id=gaia_loginform , but the html I get when running saml2aws login doesn’t have that element. It looks like google might have made an update to their login form so the form can no longer be accessed with that id.

Is there a workaround so saml2aws login can work with the updated Google form?

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 48
  • Comments: 29 (6 by maintainers)

Most upvoted comments

We’re experiencing the same issue, impacting quite a lot of users, would be good to see if there is any plans to resolve this in the very near future.

The workaround right now is to log in via the browser method until someone patches it:

SAML2AWS_IDP_PROVIDER=Browser saml2aws login --download-browser-driver

Any update on this issue?

Hey @here

For aws cli access, if you are using sam2aws for login, and if you are not happy with opening browser(re-enter username and password), you can try this config.

add this file. vim ~/.saml2aws

➜ ~ cat ~/.saml2aws

[default]
name                    = default
app_id                  =
url                     = https://accounts.google.com/o/saml2/initsso?idpid=#####&spid=#################&forceauthn=false
username                = <your email id>
provider 		= GoogleApps
#provider                = Browser
mfa                     = Auto
mfa_ip_address          =
skip_verify             = false
timeout                 = 0
aws_urn                 = urn:amazon:webservices
aws_session_duration    = 36000
aws_profile             = <profile name>
resource_id             =
subdomain               =
role_arn                =
region                  =
http_attempts_count     =
http_retry_delay        =
credentials_file        =
saml_cache              = false
saml_cache_file         =
target_url              =
disable_remember_device = false
disable_sessions        = false
download_browser_driver = true
headless                = false
prompter                =
➜  ~
  • Update the username with your email id.
  • Update your profile name
  • Update the idpid and spid values

Try to login using saml2aws login command With this, you would need to put login and password once(it will cache the details. From next time, it will pick the cached details, just hit enter) When login, you would need to approve the google prompt to approve login.

Note: please check you have latest saml2aws version -

saml2aws --version # command to get saml2aws version
2.36.18

I think, something has been fixed on google side. ToTP option is still not working.

I was getting the same error with provider GoogleApps in my ~/.saml2aws config file, but then I’ve changed that to

provider  = Browser

and it’s working fine now

Hi everyone, just letting you know that the changes made to fix this issue has just been released (v2.36.17).

If you find it’s not working, run the command with DUMP_CONTENT=true and --verbose flag. You can give me that output in the PR and I’ll see if I can fix. Thanks!

I used the new version, v2.36.17, and this time I am getting the following error. In fact, 2-step verification is activated and authentication is performed through the browser to connect.

Error authenticating to IdP.: Because of your organization settings, you must set-up 2-Step Verification in your account

I got this same error with the new version. Once I removed my passkey from my account, it was able to work.

Thank you for answer. However, the situation is the same even after deleting the passkey, in my case.

@codingtony-candid This is the one case found so far I haven’t been able to test locally, making it a bit difficult to pin down.

I started to work a bit on it here, see that conversation to understand where that’s at. https://github.com/Versent/saml2aws/pull/1286

@edwardrf had some initial changes to test that I believe are closer to the mark than where I was going. I haven’t had time to look further this week.

I suppose this can be closed with the merging of https://github.com/Versent/saml2aws/pull/1285 Is there an ETA for a new release to include the fix?

Same here… Thanks for sharing! Will give it a try as well.

@aaronthebaron I’m in the same boat. I will give a shot to your branch.

I have a pull request open to fix this issue as it’s impacting most of the users in my org. I have been able to test for myself the new login flow with a 2FA phone app.

If any of you have a different 2FA you want to test this code against, it would be appreciated.

You can build my branch and test with the local copy: https://github.com/aaronthebaron/saml2aws/tree/master?tab=readme-ov-file#building