Official Plugins (Kuzzle v2.x)
Keycloak v2.x
2

linkKuzzleUser #

Links an existing Kuzzle user to a Keycloak user. This is useful when you want to associate a Keycloak identity to an already existing Kuzzle user.

Parameters #

ParameterTypeDescriptionRequired
kuidstringKuzzle user IDyes
kcuidstringKeycloak user IDyes

Websocket #

await kuzzle.query({
  controller: 'keycloak',
  action: 'linkKuzzleUser',
  body: {
    kuid: '<kuid>',
    kcuid: '<kcuid>'
  }
});

HTTP #

POST http://<host>:<port>/keycloak/linkKuzzleUser
Content-Type: application/json
{
  "kuid": "<kuid>",
  "kcuid": "<kcuid>"
}

In witch case to use linkKuzzleUser? #

When a user is created in Keycloak, a corresponding Kuzzle user is automatically created when the user logs in for the first time.

However, if you have existing users in Kuzzle that you want to associate with Keycloak identities, you can use the linkKuzzleUser method. This allows you to link an existing Kuzzle user to a Keycloak user without creating a new Kuzzle user.

This is particularly useful in scenarios where you are migrating users to Keycloak

If you are in a case where you have no keycloak users yet and you have existing Kuzzle users, you can follow these steps:

  1. Create users in Keycloak that correspond to your existing Kuzzle users.
  2. Use the linkKuzzleUser method to link each existing Kuzzle user to the corresponding Keycloak user.