Hello,
I am looking for a way for remove username (not required) when register or even login the user.
My idea is that my “custom application” send a post request to keycloak admin-rest api.
< POST /auth/admin/realms/mylab/users/ HTTP/1.1
< Host: localhost:8080
< User-Agent: python-requests/2.25.1
< Accept-Encoding: gzip, deflate
< Accept: */*
< Connection: keep-alive
< Content-type: application/json
< Authorization: Bearer eyJhbG......etc
< Content-Length: 97
<
< {"enabled": true, "emailVerified": true, "realmRoles": ["Customer"], "email": "teste1@gmail.com"}
> HTTP/1.1 400 Bad Request
> X-XSS-Protection: 1; mode=block
> X-Frame-Options: SAMEORIGIN
> Referrer-Policy: no-referrer
> Date: Wed, 26 May 2021 18:27:47 GMT
> Connection: keep-alive
> Strict-Transport-Security: max-age=31536000; includeSubDomains
> X-Content-Type-Options: nosniff
> Content-Type: application/json
> Content-Length: 39
>
{"errorMessage":"User name is missing"}
To solve it I just created a random username with uuid4()
:
payload = {
"username": str(uuid.uuid4()),
"enabled": True,
"emailVerified": True,
"realmRoles": ["Customer"]
}
But there is a way to do that in some admin dashboard?