Reputation: 539
I have Key cloak token which is generated after getting logged in UI. I passed this token to backend which is nodeJS. In node I want to get information for this user like user role,user id. Is there any module or pakage for this?
Upvotes: 4
Views: 2709
Reputation: 1279
npm install -save jsonwebtoken
var jwt = require('jsonwebtoken');
obj = jwt.decode(token);
The obj contains any information like role, userid, ...
Upvotes: 3