Create one client for each of the five personas introduced in the overview, using the /v1/auth-servers/$AUTH_SERVER_ID/clients endpoint. Each client’s labels drive the claims configured previously.
First, create a client for Carol:
_response=$(curl -X POST "https://us.api.konghq.com/v1/auth-servers/$AUTH_SERVER_ID/clients" \
--no-progress-meter --fail-with-body \
-H "Authorization: Bearer $KONNECT_TOKEN"\
-H "Content-Type: application/json" \
--json '{
"name": "Carol",
"grant_types": [
"client_credentials"
],
"response_types": [
"none"
],
"allow_all_scopes": false,
"allow_scopes": [
"'$SCOPE_ID'"
],
"labels": {
"tier": "4x"
}
}')
Export the env variables:
export CAROL_CLIENT_SECRET=$(echo "$_response" | jq -r ".client_secret")
export CAROL_CLIENT_ID=$(echo "$_response" | jq -r ".id")
Repeat for the remaining four personas, changing only name and labels.
Create a client for Dave:
_response=$(curl -X POST "https://us.api.konghq.com/v1/auth-servers/$AUTH_SERVER_ID/clients" \
--no-progress-meter --fail-with-body \
-H "Authorization: Bearer $KONNECT_TOKEN"\
-H "Content-Type: application/json" \
--json '{
"name": "Dave",
"grant_types": [
"client_credentials"
],
"response_types": [
"none"
],
"allow_all_scopes": false,
"allow_scopes": [
"'$SCOPE_ID'"
],
"labels": {
"tier": "4x",
"cap": "strict"
}
}')
Export the env variables:
export DAVE_CLIENT_SECRET=$(echo "$_response" | jq -r ".client_secret")
export DAVE_CLIENT_ID=$(echo "$_response" | jq -r ".id")
Create a client for Erin:
_response=$(curl -X POST "https://us.api.konghq.com/v1/auth-servers/$AUTH_SERVER_ID/clients" \
--no-progress-meter --fail-with-body \
-H "Authorization: Bearer $KONNECT_TOKEN"\
-H "Content-Type: application/json" \
--json '{
"name": "Erin",
"grant_types": [
"client_credentials"
],
"response_types": [
"none"
],
"allow_all_scopes": false,
"allow_scopes": [
"'$SCOPE_ID'"
],
"labels": {
"tier": "4x",
"orgUnit": "live-balance"
}
}')
Export the env variables:
export ERIN_CLIENT_SECRET=$(echo "$_response" | jq -r ".client_secret")
export ERIN_CLIENT_ID=$(echo "$_response" | jq -r ".id")
Create a client for Frank:
_response=$(curl -X POST "https://us.api.konghq.com/v1/auth-servers/$AUTH_SERVER_ID/clients" \
--no-progress-meter --fail-with-body \
-H "Authorization: Bearer $KONNECT_TOKEN"\
-H "Content-Type: application/json" \
--json '{
"name": "Frank",
"grant_types": [
"client_credentials"
],
"response_types": [
"none"
],
"allow_all_scopes": false,
"allow_scopes": [
"'$SCOPE_ID'"
],
"labels": {
"tier": "4x",
"orgUnit": "live-balance"
}
}')
Export the env variables:
export FRANK_CLIENT_SECRET=$(echo "$_response" | jq -r ".client_secret")
export FRANK_CLIENT_ID=$(echo "$_response" | jq -r ".id")
Create a client for Grace:
_response=$(curl -X POST "https://us.api.konghq.com/v1/auth-servers/$AUTH_SERVER_ID/clients" \
--no-progress-meter --fail-with-body \
-H "Authorization: Bearer $KONNECT_TOKEN"\
-H "Content-Type: application/json" \
--json '{
"name": "Grace",
"grant_types": [
"client_credentials"
],
"response_types": [
"none"
],
"allow_all_scopes": false,
"allow_scopes": [
"'$SCOPE_ID'"
],
"labels": {
"tier": "4x",
"groups": "suspended"
}
}')
Export the env variables:
export GRACE_CLIENT_SECRET=$(echo "$_response" | jq -r ".client_secret")
export GRACE_CLIENT_ID=$(echo "$_response" | jq -r ".id")
Each client’s ID and secret are now exported as $DAVE_CLIENT_ID/$DAVE_CLIENT_SECRET, $ERIN_CLIENT_ID/$ERIN_CLIENT_SECRET, $FRANK_CLIENT_ID/$FRANK_CLIENT_SECRET, and $GRACE_CLIENT_ID/$GRACE_CLIENT_SECRET, alongside Carol’s.