Use Google Authenticator in RPA
In case two-factor authentication (2FA) is enabled, it can be rather challenging for a bot to reproduce the same behavior.
A common practice in such cases is to turn off the 2FA or MFA for bots, though, there might be some issues with getting all of the security approvals quickly.
Instead of relying on Google Authenticator tool or similar software, it is possible to generate the authentication code programmatically from a bot config.
The prerequisites are as follows.
- Robot has access to Secret Key. Use Secrets Vault for keeping the keys safe
- TOTP (Time-based One-time Password) algorithm is used. Other algorithms are also supported, though are less common.
- Server time is correct
- Add the latest version of googleauth library (BSD license) to the classpath.
- Generate an authentication code in the script block.
<script></script>
tip
Refer to the project development portal: https://github.com/wstrange/GoogleAuth.
See also Hardware Security Token Robotics.