I have built a web-based app using angular and material for which we are using flask as backend.
Now I am using the flask-login module for managing the users
Now my problem is when I authenticate and do login_user, I can print that user info using current_user.username in /login/ route
Now for some reason, I want to access current_user in other routes in the flask app, but when I tried to do so I get an error that anonymous user has no object called username
I am using mongoalchemy with my flask app. Below is the user class code I am using for this.
I solved the issue using jwt, as we are using angular as frontend, flask was not able to store the session for each user
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.