Can I create two-factor login authentication (2FA) to Streamlit apps?

Can I create two factor login authentication to Streamlit apps and how?

  • Password and face recognition for signup and login section

Hi @People, welcome to the Streamlit community!

Whenever there is a question about “can I”, the answer is almost certainly “yes, with enough effort”. But if you mean does Streamlit have a built-in method for doing this, well, no. We’ve approached the design of Streamlit to allow users to get a site built fast, for those who may not have web development experience.

The great thing about Streamlit being built in Python, however, is that anything you can do in Python on the backend should be possible with Streamlit. I’m not an expert here, but I am aware of the PyOTP library. I could imagine a solution using that in combination with session state and/or some other backend API validation to make this work.

As always, if you end up figuring it out, please come back and let everyone know how you did it!