I need to provide the impersonate functionality outside of Keycloak Admin Console, the very similiar to Impersonate button. What I am doing is calling Keycloak REST API for
- obtaining the access_token, (auth/realms/master/protocol/openid-connect/token)
- which is then parsed into another call to impersonate user admin/realms/{realm}/users/{id}/impersonation .
The second call is returning redirect link with boolean and in the headers there are, besides others, KEYCLOAK_SESSION and KEYCLOAK_IDENTITY cookies.
I need to somehow logout the user from the application, set those cookies in the browser, do the redirect to login page and be logged in as the another user. I think its common situation and Keycloak has its miracle Impersonate button which does the same, but I need to have it outside of Admin Console. Could somebody assist with hep with this issue? Many thanks