jwmajors81
jwmajors81

Reputation: 1430

Setup Keycloak Client Using REST Api

In order to have repeatable deployments of keycloak I'm trying to use the import feature to create clients in keycloak. ​ I have noticed that when I import a client, as opposed to the realm, the 'Authorization Enabled' flag is not set to true even if I have set it to true in the JSON that I'm importing. If I try to set it to true after importing I get an error unless I first turn off 'Service Accounts Enabled' and then attempt to enable 'Authorization Enabled'.

The JSON that I'm sending is provided below:

{
  "clientId" : "hello-world-authz-service",
  "secret" : "secret",
  "authorizationServicesEnabled" : True,
  "enabled" : True,
  "redirectUris" : [ "http://localhost:8080/hello-world-authz-service/*" ],
  "baseUrl": "http://localhost:8080/hello-world-authz-service",
  "adminUrl": "http://localhost:8080/hello-world-authz-service",
  "directAccessGrantsEnabled" : True
}

The JSON above is actually based upon one of the examples that was provided in the keycloak source code and it works when I import everything as a realm, but not when I use just the client portion.

Can anyone provide guidance in regards to how I can import JSON into Keycloak in order to setup a specific client?

I'm using Keycloak 2.5.0.Final Community.

Upvotes: 0

Views: 2108

Answers (1)

Jerry Saravia
Jerry Saravia

Reputation: 3837

It looks like this issue might have been resolved by this pull request:

https://github.com/keycloak/keycloak/commit/0b5b27ea3a9d68a26e9cd592a1b087ea7478a07c

I can see in the pull request that the code references the authorizationServicesEnabled field.

Upvotes: 1

Related Questions