Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add custom key/value to JWT token payload or user with keycloak

I have keycloak running in localhost. I want to

  • add a key/value pair to the token payload
  • or add a key/value pair related to the user (payload again)

Can you suggest me a way to do this and a way to verify that it has been added?

(I guess with https://jwt.io/)

like image 237
The Strong Programmer Avatar asked Mar 09 '23 00:03

The Strong Programmer


1 Answers

As mentioned above by Sébastien, a mapper should be added. So I have added a mapper user attribute and then I went to users->attributes and added the same key name with its value. I verified it afterwards, the key/value pair is included in the payload

like image 103
The Strong Programmer Avatar answered Apr 09 '23 13:04

The Strong Programmer