Flask simple password protect on page load

Is there a simple way to password protect a flask app site? I’ve looked into flask_login and various other implementations but they seem overkill for what I’m looking for.

This doesn’t need to be overly secure, nor do I need any login sessions. Just a simple:
“enter password, once correct, page loads”.

I would prefer to avoid login pages as well. Just maybe a javascript popup that is prompted and hides the page/div until password is typed in.

Bonus, if possible and easy not having the password itself appear in the source code of the website.

Any suggestions appreciated.


Flask Login is the de facto login solution for Flask. So even you think this would be an overkill, actually it is not that complicated and you would learn something useful you will need for almost any future Flask app.

On the other hand, if you do not mind the basic GUI, http basic auth is dead simple and you do not need to write a single line of code.


Whatever solution you choose, do not forget to use HTTPS.

Leave a Reply

Your email address will not be published. Required fields are marked *