Skip to content

Instantly share code, notes, and snippets.

View rclement's full-sized avatar
⛰️

Romain Clement rclement

⛰️
View GitHub Profile

Keybase proof

I hereby claim:

  • I am rclement on github.
  • I am rmnclmnt (https://keybase.io/rmnclmnt) on keybase.
  • I have a public key ASD0eJyGsaum2aIoeTGt3INyNsOB_FaXB7V9KKPTxtTC-go

To claim this, I am signing this object:

@rclement
rclement / python_totp_handling.md
Last active July 17, 2020 16:14
TOTP handling in Python

Here are some basic snippets to handle TOTP tokens in Python.

Please not these are not related to Flask in anyway! You can adapt it in any context and/or framework (FWIW last time I implemented something along thoses lines was using the FastAPI framework. Check it out, it's pretty great!).

Here we go:

  1. Define some sort of multi-factor authentication table in your database, holding securely the shared secret for each user.