miguelgrinberg / Flask-HTTPAuth

Simple extension that provides Basic, Digest and Token HTTP authentication for Flask routes
MIT License
1.27k stars 228 forks source link

Examples of HTTPBasicAuth need to be shown with HTML too #134

Closed nav9 closed 3 years ago

nav9 commented 3 years ago

Hello. To experienced people, it might be simple to understand how authentication works, just by looking at the ".py" examples you've given. However, for any new person, it's hard to figure out how control flows to the various functions and how HTTPBasicAuth handles requests. I for example, was trying to figure out how to redirect to a login page instead of having the authentication popup showing up. There are so many more examples showing people's confusion on how to use the library: https://stackoverflow.com/search?q=HTTPBasicAuth. It's a good library, but I do hope that you try seeing it from the perspective of users (especially from the questions on StackOverflow) and create examples that also show some HTML forms along with the python code.

miguelgrinberg commented 3 years ago

@nav9 You have a misunderstanding regarding this library. The library implements a few algorithms from the HTTP standard, most importantly the HTTP Basic Authentication protocol. This is not a library to create login forms, and normally you would not even use login forms with it.

If you want to create a login experience for an application that uses HTML, I recommend that you look at the Flask-Login extension, which is more appropriate for your use case.