Selenium automation to handle DUO 2FA

Hi
We are doing our web application automation testing via Selenium and we have 2 FA done via DUO as part of login. We want to automate 2FA process and not wait for mobile or some device to authenticate in middle. Can you let me know if there is a mechanism / API available which can be leveraged for DUO 2FA to fetch/generate token from server and no manual intervention may be required.

Thanks & Regards,
Manoj

Hi Manoj, welcome to the Duo Community, and thanks for sharing your question here!

While there is not currently a mechanism for this, there are a few things you could consider. Multifactor authentication will always add a small delay in the authentication process, as it is an extra step in the process. However, WebAuthn authenticators like Yubikeys or other platform biometric authenticators such as Face ID or Touch ID might be right for you, as they add less “friction” and tend to be faster than more traditional authenticators like mobile apps or hardware tokens. We’re also looking at ways to reduce the number of prompts end-users receive, though it’s not something available immediately to you today.

In your particular case though, you could look at building your own OTP software token and feeding the OTP codes into your automation as they change. I hope that helps!

Thanks for the confirmation.
If there are any plans to enable this for integration programmatically, do let me know.

1 Like

If your Selenium testing is always using a specific account when it does the login, perhaps you could create a Duo bypass code (in the Duo Admin panel) for that account. You could set the code to have unlimited uses and never expire, which might be acceptable for a test account.

1 Like