feat: keycloak service add other params
For additional paramater (Take a look at keycloak admin RestAPI manual)
This commit is contained in:
parent
21c4901e4f
commit
ed75115651
1 changed files with 2 additions and 1 deletions
|
|
@ -65,7 +65,7 @@ export async function getToken() {
|
||||||
*
|
*
|
||||||
* @returns user uuid or true if success, false otherwise.
|
* @returns user uuid or true if success, false otherwise.
|
||||||
*/
|
*/
|
||||||
export async function createUser(username: string, password: string) {
|
export async function createUser(username: string, password: string, opts?: Record<string, any>) {
|
||||||
const res = await fetch(`${KC_URL}/admin/realms/${KC_REALM}/users`, {
|
const res = await fetch(`${KC_URL}/admin/realms/${KC_REALM}/users`, {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -77,6 +77,7 @@ export async function createUser(username: string, password: string) {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
credentials: [{ type: "password", value: password }],
|
credentials: [{ type: "password", value: password }],
|
||||||
username,
|
username,
|
||||||
|
...opts,
|
||||||
}),
|
}),
|
||||||
}).catch((e) => console.log("Keycloak Error: ", e));
|
}).catch((e) => console.log("Keycloak Error: ", e));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue