I am using JWT for my Node+Express API's route protection; I normally store the user's profile information in the jwt token, unless is granular PII. But I want to know what the best practice is for this.
I have the following user schema (mongoose):
USER {
_id: ObjectID,
userName: string,
img: string,
email: string,
role: string
}
I probably don't want to throw the img in the JWT payload to avoid unwanted hashing costs, but what other information/properties can I throw in the JWT payload?
-- Is there a performance limiting factor to larger JWT's?
I have seen some people only using the _id and username properties, but I would like to have a standard that I stick to to keep everything nice and uniform.
Thanks! :)