Skip to content

Show Duo verification code during Duo authentication#1

Open
Syazvinski wants to merge 1 commit intoShaneBerhoff:mainfrom
Syazvinski:duo-verification-code
Open

Show Duo verification code during Duo authentication#1
Syazvinski wants to merge 1 commit intoShaneBerhoff:mainfrom
Syazvinski:duo-verification-code

Conversation

@Syazvinski
Copy link
Copy Markdown

This PR adds a small enhancement to the Duo authentication flow so the CLI prints the 6-digit Duo verification code when it appears on the page.

What’s changed

  • src/elements.rs

    • Added a selector for the verification code container:
      • duo_verification_code: "div.verification-code",
  • src/main.rs

    • Updated duo_transition to:
      • Poll for elements.duo_verification_code.
      • When found, read inner_text, trim it, and if non-empty:
        • println!("Duo verification code: {}", code);
        • println!("Enter this code in Duo Mobile to approve the login.");
      • Only print once per Duo flow (code_announced flag).

Why

On Emory’s Duo page (and similar setups), Duo shows a short numeric verification code on the web page that the user must type into the Duo Mobile app. When running the CLI in a terminal, users often don’t have the browser in front of them, so they can’t see the code.

By surfacing the code in the CLI, users can complete Duo from their phone without having to look at the browser window, while keeping the rest of the Duo flow unchanged.

Scope

  • No changes to selectors other than adding duo_verification_code.
  • No changes to the existing trust/timeout/cart detection logic.
  • Behavior is unchanged unless a div.verification-code is present, in which case the code is printed once and the flow proceeds as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant