Is it a good practice to store user information (email, name, role, etc.) in JWT access tokens?
I'm implementing JWT authentication in a FastAPI application and wondering whether it's a good practice to store basic user information, such as user_id, email, name, and role, inside the JWT access token. My intention is to avoid querying the database on every authenticated request just to retrieve basic user information. However, I'm concerned about data consistency when a user's information changes. For example: A user logs in from multiple devices, creating multiple active sessions. Their role or email gets updated. All existing access tokens still contain the old user information. The app
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.