How to generate TOTP / 2FA code using key

I have an application login which requires TOTP to login. I am able to do so via manually entering 2FA code from authenticator app.

Is there any alternative to this? Where i can enter the TOTP key one time and 2FA code will be automatically generated on give time?

Hi @tryabp

The whole point of 2FA is that a unique code will be generated for each login, which will have to be manually entered by you.

A solution to this problem is to use “app passwords” (provided the application you are using has the support for “app passwords”)

Many companies out there (Microsoft, Google etc) allow you to login to use their services via the use of “app passwords” (in the scenario where 2FA is enabled)

1 Like

Hello @Harsh,

I understand that TOTP is time bound otp and its generated with periodic intervals in authenticator app. I got info on Google that Python script is there https://pypi.org/project/pyotp/ which generate TOTP dynamically just like authenticator app on giving secret key input, i want to know if its possible to implement similar thing in make automation.

Hello,

Just out of curiosity, what are the circumstances under which you need this?

I do not think it’s possible to do this natively in Make.
There is a piece of the algorithm that requires calculations Make can’t do, nor can Make handle the large numbers involved.

I think you’ll have to find a web service with an API that will do this for you.
I looked and was not able to find any, however, some modules can run Python code so maybe give those a shot.

3 Likes

@Donald_Mitchell Donald_Mitchell

I am implementing an scenario for stock market trading where login using API requires TOTP from authenticator app.

Got it… well it’s definitely possible to do with that pyotp Python library tryabp mentioned, but I had trouble generating the correct code with native Python libraries or Make functions. Maybe someone else out there can do it, I just don’t have much more time for it.

There’s a 0-CodeKit module (you need to pay for credits) that can run Python scripts, but it didn’t want to import the pyotp library so maybe you can check that one out.

Wish you luck!

3 Likes

@Donald_Mitchell

Thanks for your input. I am trying to implement python script in Google Sheets and generate TOTP. So that make can easily fetch data from sheets.