HOW #5 – Handle two factor authentication with the robot
All applications containing confidential data should require two factor authentication. But what if you need to automate that process?
If you’re wondering how to handle two factor authentication with the robot than continue reading.
Hello! I’m pretty sure that all of you has came to contact with multi-factor authentication at least once. This technique has significantly helped to reduce the incidence of online identity theft because the access to a website or application is granted only after successfully presenting two or more pieces of evidence to an authentication mechanism. All applications containing confidential data should require two factor authentication. But what if you need to automate that process?
That’s the problem we had to solve since almost all applications that our robots operate in requires two factor authentication to verify the user identity. Now let’s take a look on how to generate authorization code with a python library called pyotp. There’s a TOTP handler which contains methods to generate the one-time passwords. The only thing you need to know is secret key which is used for one-time password calculation. You can get this key while you’re setting up two factor authentication for your account (e.g., Google).
Here is an example of TOTP generated with python vs google authenticator: