keycloak-nodejs-admin-client
keycloak-nodejs-admin-client copied to clipboard
No group assigned while creating a user
Describe the bug When I try to create a user with a group by default, it does not work.
To Reproduce Steps to reproduce the behavior:
- What API did you use? I just:
- Installed keycloack in local, configured it and created an example realm and group
- Created the example that is in your readme
- Added groups to the create method...
- Everything works except the group is not assigned
- What error message did you see? No error is showed, the user is created but no group is assigned
- Give us a minimum code example
await kcAdminClient.users.create({
realm: 'realm-test',
username: 'username',
email: '[email protected]',
groups: ['group-test'],
enabled: true
});
Expected behavior To create the user but with the group assigned
Screenshots NA
Enviroment (please complete the following information):
- OS: [e.g. Ubuntu] MacOS Catalina
- Keycloak Version 8.0
- Library Version [e.g. 1.9.0] lastest
Additional context NA
Thanks! Isma
+1
I've also tried using the groupId but it does not seem to be working.
await kcAdminClient.users.create({
username: 'username',
email: '[email protected]',
groups: ['4aedc1c8-9f60-4125-81e3-9cc7c8ca8238'],
enabled: true
});
+1
+1
I was success usign your example @Ismaestro.
To have this work, I ended up using the path
of the group instead and it works.
For e.g.
const path = '/Kunden/Hauptbenutzer/example'
await client.users.create({
username: 'testat',
email: '[email protected]',
emailVerified: true,
enabled: true,
groups: [path]
})