py2fa /

Filename Size Date modified Message
90 B
1.3 KB
1.4 KB
3.8 KB
412 B

pyg2fa - Google two factor Authentication


Welcome to g2fa. Google two factor auth for Python based apps.

Repo: $hg clone


hg clone cd pyg2fa python install


  • for test run
    import pyg2fa
  • The test uses YOUR_SECRET_INITIAL_KEY, it should be at least 16, base 32 characters, this is secret, this could be different for different web app users
  • It will print the URL of QR code, Scan it using your Google Authenticator application
  • For testing enter the OTP generated by the Google Authenticator, the python program should print True if everything goes right.
  • make sure time on your comp and on your phone is in sync

Demo app:

  • cd pyg2fa/demo
  • python
  • follow the instructions


  • Clock on server and on android need to be in sync

Recent change:

  • Added validate method which will allow clients clock to drift server time by +/- defined seconds.
  • Developer documents and an demo web application