Sapan Soni
Sapan Soni

Reputation: 59

current_user is object is anonymous even though I am logged in

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.

enter image description here

Upvotes: -1

Views: 231

Answers (1)

Sapan Soni
Sapan Soni

Reputation: 59

I solved the issue using jwt , as we are using angular as frontend , flask was not able to store the session for each user

Upvotes: 0

Related Questions