Updating admin-cli

Keycloak v19.0.1

Trying to update admin-cli client settings, but whenever I click save, it doesn’t actually save. I used chrome inspector and saw an error. How can I fix this?

LogoutPanel.tsx:139 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘startsWith’)
at validate (LogoutPanel.tsx:139:27)
at je (index.esm.mjs:802:34)
at X (index.esm.mjs:1606:46)
at async X (index.esm.mjs:1621:22)
at async Object.fe [as trigger] (index.esm.mjs:1818:42)
at async ne (ClientDetails.tsx:322:11)

correction: I am on v21.0.1 and I’ve restarted the server many times. the error now looks like:


uncaught (in promise) TypeError: crypto.randomUUID is not a function
at Alerts.tsx:51:20
at Alerts.tsx:64:5
at ne (ClientDetails.tsx:363:7)

any advice here would be appreciated!

Issue is resolved. After updating my admin-cli settings, the ‘credentials’ tab appeared, and after I clicked the tab, my changes persisted.

This seems to be an issue with keycloak version 21.1.1.

Since the direct access grant is enabled by default I found a work around by using keycloak-admin-client.

Below is the snippet code to update the client to enable client authentication. Once client authentication was enabled I was able to change other setting from UI.

Keycloak keycloak = KeycloakBuilder
                .builder()
                .serverUrl("http://localhost:8080")
                .realm("<realm_name>")
                .grantType(OAuth2Constants.PASSWORD)
                .clientId("admin-cli")
                .username("<username>")
                .password("<password>")
                .build();
RealmResource realmResource = keycloak.realm("<realm_name>");
ClientResource clientResource = realmResource.clients().get("<client_id>"); // client id of admin-cli
ClientRepresentation clientRepresentation = clientResource.toRepresentation();
clientRepresentation.setPublicClient(false);
clientResource.update(clientRepresentation);

Make sure to update for your code. Also the given username and password must have the correct roles of realm-management client.