saml2aws icon indicating copy to clipboard operation
saml2aws copied to clipboard

GoogleApps: login fails with false "2-step Verification" error when Passkey is registered on Google Account

Open marsboy02 opened this issue 8 months ago • 2 comments

Problem

After registering a Passkey (via Bitwarden) on my Google Workspace account, saml2aws login using the GoogleApps provider immediately fails with:

Because of your organization settings, you must set-up 2-Step Verification in your account

2-Step Verification is fully configured (OTP, Google Prompts, SMS, and Passkeys are all active). The error is a false positive. Removing the Passkey from the Google account immediately restores normal login behavior — confirmed and reproducible.

Environment

  • saml2aws version: 2.36.19 (latest as of March 2026)
  • OS: macOS (Apple Silicon)
  • Provider: GoogleApps
  • MFA setting: Auto
  • Google Workspace: 2-Step Verification enforced by organization
  • "Skip password when possible": Disabled by admin policy

Steps to Reproduce

  1. Have a working saml2aws login setup with GoogleApps provider and 2FA (OTP/Google Prompts)
  2. Register a Passkey on the Google account (e.g. via Bitwarden)
  3. Run saml2aws login → fails with false "2-Step Verification" error
  4. Remove the Passkey from Google account → saml2aws login works again

A colleague with the same organization settings but without a Passkey registered can log in without issues.

Verbose Log Comparison

With Passkey registered (BROKEN)

The password challenge succeeds (200 OK), but isMissing2StepSetup fires immediately — the flow never reaches the MFA challenge step:

DEBU HTTP Req  URL=".../v3/signin/challenge/pwd?TL=..." method=POST
DEBU HTTP Res  Status="200 OK"
Because of your organization settings, you must set-up 2-Step Verification in your account
github.com/versent/saml2aws/v2/pkg/provider/googleapps.isMissing2StepSetup
        github.com/versent/saml2aws/v2/pkg/provider/googleapps/googleapps.go:182

Without Passkey (WORKING)

The same password challenge succeeds, and saml2aws correctly finds the secondActionURL and proceeds to the Google Prompts MFA challenge:

DEBU HTTP Req  URL=".../v3/signin/challenge/pwd?TL=..." method=POST
DEBU HTTP Res  Status="200 OK"
DEBU secondActionURL: .../v3/signin/challenge/dp?TL=...
Check your phone and tap 'Yes' on the prompt. Then press ENTER to continue.
DEBU HTTP Req  URL=".../v3/signin/challenge/dp?TL=..." method=POST
DEBU HTTP Res  Status="200 OK"
? Please choose the role ...
Logged in as: arn:aws:sts::***:assumed-role/...

Key Difference

The divergence happens right after /v3/signin/challenge/pwd returns 200 OK:

With Passkey Without Passkey
Password challenge ✅ 200 OK ✅ 200 OK
Next step ❌ isMissing2StepSetup false positive ✅ secondActionURL → /v3/signin/challenge/dp
MFA prompt Never reached "Check your phone and tap 'Yes'"
Result Error Login success

When a Passkey is registered, Google includes different HTML elements in the post-password response page (likely a Passkey-related prompt or interstitial). This HTML contains a <section> element with CSS class aN1Vld, which isMissing2StepSetup incorrectly interprets as a "2FA not configured" page.

Root Cause

In googleapps.go:182:

func isMissing2StepSetup(responseDoc *goquery.Document) error {
    if responseDoc.Selection.Find("section.aN1Vld ").Text() != "" {
        return errors.New("Because of your organization settings, you must set-up 2-Step Verification in your account")
    }
    return nil
}

This check is too broad. The section.aN1Vld CSS class is not exclusive to the "2FA not configured" page — it also appears when Google presents a Passkey-related interstitial after password authentication. Since saml2aws checks for element presence rather than specific content, it cannot distinguish between the two pages.

Related Issues

This is part of a recurring pattern where Google login page changes break saml2aws's HTML scraping:

  • #1259 — gaia_loginform ID removed by Google
  • #933 — "page is missing saml assertion" after Google update
  • #522 — Google 2FA verification page unrecognized

Workaround

  • Option A: Remove the Passkey from the Google account → immediately restores normal login
  • Option B: Use Browser mode: SAML2AWS_IDP_PROVIDER=Browser saml2aws login

Suggested Fix

  1. Match on specific text content within the section.aN1Vld element (e.g., check for "set up 2-Step Verification" or equivalent setup strings) rather than just checking element presence
  2. Check the page URL path — the 2FA enrollment page likely has a distinct URL vs. a Passkey prompt
  3. Try to extract secondActionURL first before running isMissing2StepSetup — if a valid challenge URL exists, the page is clearly not a setup page

marsboy02 avatar Mar 16 '26 02:03 marsboy02

I also experienced this problem and had to remove my passkey (which is preferable and more secure for my setup).

fredtony avatar Jun 24 '26 18:06 fredtony

Same error here, but removing the passkey didn't help — it failed both with and without one registered (2.36.19, macOS, Workspace with 2SV enforced).

The only item flagged on our account security page was "Add a passkey", so Google may be serving a real setup interstitial rather than this being a false positive. No way to tell, which is the real problem: isMissing2StepSetup() matches section.aN1Vld and then prints a hard-coded reason, dropping the page text. Printing the matched text instead would have saved us deleting and re-registering a passkey to find out.

Switched to the Browser provider in the end.

raphaelIl avatar Sep 17 '26 17:09 raphaelIl