Discover Flask, Part 23 - Managing Sessions with Flask-Login

preview_player
Показать описание
In this part we'll look at refactoring our session management mechanism using the powerful Flask-Login extension.

Links:

Рекомендации по теме
Комментарии
Автор

Sweet. My Heroku needed some love after watching the last couple videos. Also the Procfile on the discover-flask repo still has "app:app"

Just started this series a couple days ago and I'm excited to continue

mikehobi
Автор

Hi, I enjoy watching this video.
One thing, can you let me know why the Invalid salt error occurs?

johnsonm.
Автор

Could you show how to use Flask-Login in conjunction with Flask-LDAP? Much appreciated

MrNiceseb
Автор

Hi Michael, excellent series. Doesn't having "from models import User" in __init__.py and "from project import db"
"from project import bcrypt" in models.py consitute circularly dependent imports?

drpm
Автор

Can you use Flask-Login to do token based authentication for an API?

rishidesai
Автор

What are the advantages of using this over the original sessions method initially implemented?

sSingbomb
Автор

Hello,  Michael.

I don't understand exactly what means these lines in project/__init__.py:

@login_manager.user_loader
def load_user(user_id):
    return User.query.filter(User.id == int(user_id)).first()

As I understood *load_user* func takes *user_id* value from session and try to find this value in db. Right? In case if user.id exists in db - user is still logged in.

Anyway, thank you for work. I am very appreciate that.

Ipeacocks
Автор

This is good for restricting client views, but if the server wanted a global list of who is logged in, could this be done with Sessions? The server would need a way of iterating over the client Sessions to check if they are logged in, because clients could let their Sessions expire instead of actively logging out.The use case could be displaying active users in a lobby.

MrInvertible
Автор

By default, sessions in Flask are cleared upon refreshes and redirects. Is there a way to make sessions persist across these events?

MrInvertible