Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 914
Shreyansh Bele Avatar asked Sep 18 '25 18:09

Shreyansh Bele


1 Answers

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

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

like image 59
Jojo.Lechelt Avatar answered Sep 20 '25 08:09

Jojo.Lechelt