Thejus32
Thejus32

Reputation: 371

Unknown error while creating client using Keycloak REST API

I'm trying to create a new client in my Springboot realm through the keycloak REST API using postman, but I'm getting an unknown error as the response.

The URL in post method is

localhost:8180/auth/admin/realms/springboot/clients

The header includes:

content-type - application/json
authorization - bearer <access token...>

The JSON body is

{    
  "id":"1",
  "clientId":"zzzzz",
  "name":"aaaaa",
  "description":"bbbbb",
  "redirectUris":[ "\\" ],
  "enabled":"true"
}

The response I'm getting is 403 : unknown error.

Upvotes: 7

Views: 18440

Answers (2)

kamal soni
kamal soni

Reputation: 11

403 is when you are not authorized. you need to add the role to concerned user as shown in below video (user -> role mapping -> assign role -> filter by clients) https://www.youtube.com/watch?v=uob6GE_IvZw&t=603s

Upvotes: 0

Pythtotic
Pythtotic

Reputation: 475

I obtained the same error because the client had not the necessary role.

  • Go to Clients -> {your-client-name}
  • Select the 'Service Account Roles' tab
  • Add the necessary role. (In my case I needed the admin role)

enter image description here

Upvotes: 15

Related Questions