feat: keycloak service add other params

For additional paramater (Take a look at keycloak admin RestAPI manual)
This commit is contained in:
Methapon2001 2024-04-01 21:06:24 +07:00
parent 21c4901e4f
commit ed75115651

View file

@ -65,7 +65,7 @@ export async function getToken() {
*
* @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`, {
// prettier-ignore
headers: {
@ -77,6 +77,7 @@ export async function createUser(username: string, password: string) {
enabled: true,
credentials: [{ type: "password", value: password }],
username,
...opts,
}),
}).catch((e) => console.log("Keycloak Error: ", e));