Shreyansh Bele
Shreyansh Bele

Reputation: 539

Getting information from Keycloak Token in NodeJS

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

Answers (1)

Jojo.Lechelt
Jojo.Lechelt

Reputation: 1279

npm install -save jsonwebtoken
var jwt = require('jsonwebtoken');
obj = jwt.decode(token);

The obj contains any information like role, userid, ...

Upvotes: 3

Related Questions