I wanted to create a custom scope in Keycloak with the default type. I tried the following request on Kecloak 19.0.2 version
POST http://localhost:8080/auth/admin/realms/master/client-scopes
{
"attributes": {
"display.on.consent.screen": "false",
"include.in.token.scope": "false",
"gui.order": "1"
},
"name": "example",
"description": "example",
"type": "default",
"protocol": "saml"
}
But it is always created with type None.

This is the same request Keycloak uses when created from UI

You needs to call this API after call POST /{realm}/client-scopes
Here is document
PUT /{realm}/default-default-client-scopes/{clientScopeId}

Get master token by curl
curl --location --request PUT 'http://localhost:8080/auth/admin/realms/master/default-default-client-scopes/80854f36-5646-4fb4-aeca-581b18064c54' \
--header 'Authorization: Bearer '"$MASTER_TOKEN"
Then you can see the result from UI.

The clientScopeId get from GET /{realm}/client-scopes API

Client Scopes's Body parameter do not include type


If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With