Simple two factor authemtication system, made by me.

Honestly, i don't even know How 2FAs work I just used my knowledge and did whatever i could.

Sends code to an email. The code expires in 60 seconds.

How to run

from TwoFactorAuthentication.src import auth

twofa = auth.twoFA(GOOGLE_SECRET_KEY = 'here',senderEmail = '[email protected]')

Read below to know, how to get your Secret Key.


To make this work. You will need to enable Two Factor Authentication in your email first.

Then go to.. and enable the Less Secure Apps option, otherwise you won't be able to send emails through code.

After that, go to and create an app password, with any name. Copy the code that google gives you and paste it here. That's your GOOGLE_SECRET_KEY param.

Now for the senderEmail just write your email, in which you created the apppassoword.

That's it.