[keycloak-user] Error creating realm role with attributes

Łukasz Dywicki luke at code-house.org
Mon Jun 17 05:07:36 EDT 2019


This is kinda expected as representation you use is only used to fetch
id, name and description. Rest of data is ignored. See relevant admin
resource sources:
https://github.com/keycloak/keycloak/blob/6.0.1/services/src/main/java/org/keycloak/services/resources/admin/RoleContainerResource.java#L114

Effectively you need to execute two requests - one with create, second
with update of attributes.

Kind regards,
Łukasz Dywicki
--
Code-House http://code-house.org

On 17.06.2019 10:48, Rafael Tovar. wrote:
> Hi everybody,
> I'm trying to create a realm role with custom attributes.
> When i make this POST request:
> /auth/admin/realms/master/roles
> with the following body:
> {
>    "name":"test_user",
>    "description": "im a test user",
>    "attributes":  {
>          "color": "#555"
>    }
> }
> I get the error: Cannot deserialize instance of `java.util.ArrayList` out
> of VALUE_STRING token
> 
> And when i try the request with this body:
> {
>    "name":"test_user",
>    "description": "im a test user",
>    "attributes":  {
>          "color": ["#555"]
>     }
> }
> I get a 201 but the role is created without the color attribute.
> 
> Thanks,
> Rafael.
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
> 


More information about the keycloak-user mailing list