Two-factor authentication (2FA) and One Time Passwords (OTP)
Last updated
Last updated
To test 2FA usually one of the many Authentication Apps is required. TestResults.io has build a NuGet Package with the same functionality.
The Nuget can be found online:
Check out the Demo Testcase using our NuGet to generate Codes from a QR-Code.
Navigate to "Manage NuGet Packages" in the context menu of the Testcase Project.
Search and install the current version of the NuGet "TestResults.Addon.OTP".
Navigate back to your test case. At the top add the using of the new Nuget.
Inside a teststep make sure to navigate to the screen where you enable 2FA and make sure the QR code is visible on the screen.
The following code can be used to generate a one time password with the QR-Code currently shown on the Screen:
WARNING: make sure to save the logged "otpAuthUri" string if you enable 2FA or you will be later locked out of this account
If the password gets rejected, it is most likely already expired as a password is usally only valid for one minute. Use the following code to request a new one. The same code can be used to request a password if you logout and login again.