Show and Tell: full authentication flow example, dash-auth-flow

Okay. Ignore the current_user stuff for now as you are new to it (watch https://www.youtube.com/watch?v=2dEM-s3mRLE for an overview and do the tutorial at https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-v-user-logins for hands-on practice).

Try this: put the user’s email into the Flask session variable. In the login page callback function, when the function doessession['authed']=True, add the following code, replacing with the variable containing the user’s email:

session['email'] = the_user_email

Then in the home page, you can write a callback function that returns session['email'] to the children property of the html.H2 where you want it.

Generally, you should learn about Flask and Dash a lot more before you use authentication. If you need authentication, you need to understand the framework well to make sure it is safe.

2 Likes