One-time password is pretty common these days for any type of account that offers two-factor authentication. We can use an app to generate OTP but it would be troublesome if we lost the app or the phone. Fortunately there’s a simple way to generate OTP programmatically using libraries such as Python OneTimePass.
First, install OneTimePass with pip:
| |
Then you get the secret generated from the service provider you’re using. Normally it would be a time-based token, such as the ones you use for Google Authenticator.
To get time-based token you invoke it like this:
| |
Remember to store your secret safely.