I had to implement user impersonation using Keycloak. I haven’t found any e2e solution so I decided to write short post about how we can achieve that.
First you need to start your Keycloak instance with these flags:
It’s allow us to use token exchange feature which is not enabled by default.
Then we need to enable impersonation for our client in Keycloak console.
After that we need to grant impersonation for specified user:
When we have configuration part done, we can move forward to implementation which is not much complex.
This is implementation of TypeScript service used in my Angular app for a token exchange.
In response from Keyclok you should received new tokens pair.
Hope you enjoy this post. If You have any questions or problems leave a comment or send email.
See You soon!