TAGS :Viewed: 10 - Published at: a few seconds ago

[ How to decode a JWT token in waterlock ]

I am using waterlock for authentication in a sails.js app and want to add a custom attribute to jwt. I am not able to find in the doc, how I can decode and access the jwt token in policies. I don't want to add any third party decoding libraries as I am already using waterlock. So far I've done this by req.session.user.group.id but ideally I would want to access the group id directly through jwt.

Answer 1


Waterlocks installs jwt-simple module so I guess you should be able to use jwt.decode