Chilkat Online Tools

TCL / Auth0 Management API / Update a client

Back to Collection Items

load ./chilkat.dll

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

set http [new_CkHttp]

# Use this online tool to generate code from sample JSON: Generate Code to Create JSON

# The following JSON is sent in the request body.

# {
#   "name": "",
#   "client_secret": "",
#   "logo_uri": "",
#   "callbacks": [
#     ""
#   ],
#   "allowed_origins": [
#     ""
#   ],
#   "client_aliases": [
#     ""
#   ],
#   "allowed_clients": [
#     ""
#   ],
#   "allowed_logout_urls": [
#     ""
#   ],
#   "jwt_configuration": {
#     "lifetime_in_seconds": 0,
#     "secret_encoded": true,
#     "scopes": {},
#     "alg": ""
#   },
#   "encryption_key": {
#     "pub": "",
#     "cert": "",
#     "subject": ""
#   },
#   "sso": true,
#   "custom_login_page_on": true,
#   "token_endpoint_auth_method": "",
#   "app_type": "",
#   "is_first_party": true,
#   "custom_login_page": "",
#   "custom_login_page_preview": "",
#   "form_template": "",
#   "addons": {
#     "aws": {},
#     "azure_blob": {},
#     "azure_sb": {},
#     "rms": {},
#     "mscrm": {},
#     "slack": {},
#     "box": {},
#     "cloudbees": {},
#     "concur": {},
#     "dropbox": {},
#     "echosign": {},
#     "egnyte": {},
#     "firebase": {},
#     "newrelic": {},
#     "office365": {},
#     "salesforce": {},
#     "salesforce_api": {},
#     "salesforce_sandbox_api": {},
#     "samlp": {},
#     "layer": {},
#     "sap_api": {},
#     "sharepoint": {},
#     "springcm": {},
#     "wams": {},
#     "wsfed": {},
#     "zendesk": {},
#     "zoom": {}
#   },
#   "resource_servers": [
#     {
#       "identifier": "",
#       "scopes": [
#         ""
#       ]
#     }
#   ],
#   "client_metadata": {},
#   "mobile": {
#     "android": {},
#     "ios": {}
#   }
# }

set json [new_CkJsonObject]

CkJsonObject_UpdateString $json "name" ""
CkJsonObject_UpdateString $json "client_secret" ""
CkJsonObject_UpdateString $json "logo_uri" ""
CkJsonObject_UpdateString $json "callbacks[0]" ""
CkJsonObject_UpdateString $json "allowed_origins[0]" ""
CkJsonObject_UpdateString $json "client_aliases[0]" ""
CkJsonObject_UpdateString $json "allowed_clients[0]" ""
CkJsonObject_UpdateString $json "allowed_logout_urls[0]" ""
CkJsonObject_UpdateInt $json "jwt_configuration.lifetime_in_seconds" 0
CkJsonObject_UpdateBool $json "jwt_configuration.secret_encoded" 1
CkJsonObject_UpdateNewObject $json "jwt_configuration.scopes"
CkJsonObject_UpdateString $json "jwt_configuration.alg" ""
CkJsonObject_UpdateString $json "encryption_key.pub" ""
CkJsonObject_UpdateString $json "encryption_key.cert" ""
CkJsonObject_UpdateString $json "encryption_key.subject" ""
CkJsonObject_UpdateBool $json "sso" 1
CkJsonObject_UpdateBool $json "custom_login_page_on" 1
CkJsonObject_UpdateString $json "token_endpoint_auth_method" ""
CkJsonObject_UpdateString $json "app_type" ""
CkJsonObject_UpdateBool $json "is_first_party" 1
CkJsonObject_UpdateString $json "custom_login_page" ""
CkJsonObject_UpdateString $json "custom_login_page_preview" ""
CkJsonObject_UpdateString $json "form_template" ""
CkJsonObject_UpdateNewObject $json "addons.aws"
CkJsonObject_UpdateNewObject $json "addons.azure_blob"
CkJsonObject_UpdateNewObject $json "addons.azure_sb"
CkJsonObject_UpdateNewObject $json "addons.rms"
CkJsonObject_UpdateNewObject $json "addons.mscrm"
CkJsonObject_UpdateNewObject $json "addons.slack"
CkJsonObject_UpdateNewObject $json "addons.box"
CkJsonObject_UpdateNewObject $json "addons.cloudbees"
CkJsonObject_UpdateNewObject $json "addons.concur"
CkJsonObject_UpdateNewObject $json "addons.dropbox"
CkJsonObject_UpdateNewObject $json "addons.echosign"
CkJsonObject_UpdateNewObject $json "addons.egnyte"
CkJsonObject_UpdateNewObject $json "addons.firebase"
CkJsonObject_UpdateNewObject $json "addons.newrelic"
CkJsonObject_UpdateNewObject $json "addons.office365"
CkJsonObject_UpdateNewObject $json "addons.salesforce"
CkJsonObject_UpdateNewObject $json "addons.salesforce_api"
CkJsonObject_UpdateNewObject $json "addons.salesforce_sandbox_api"
CkJsonObject_UpdateNewObject $json "addons.samlp"
CkJsonObject_UpdateNewObject $json "addons.layer"
CkJsonObject_UpdateNewObject $json "addons.sap_api"
CkJsonObject_UpdateNewObject $json "addons.sharepoint"
CkJsonObject_UpdateNewObject $json "addons.springcm"
CkJsonObject_UpdateNewObject $json "addons.wams"
CkJsonObject_UpdateNewObject $json "addons.wsfed"
CkJsonObject_UpdateNewObject $json "addons.zendesk"
CkJsonObject_UpdateNewObject $json "addons.zoom"
CkJsonObject_UpdateString $json "resource_servers[0].identifier" ""
CkJsonObject_UpdateString $json "resource_servers[0].scopes[0]" ""
CkJsonObject_UpdateNewObject $json "client_metadata"
CkJsonObject_UpdateNewObject $json "mobile.android"
CkJsonObject_UpdateNewObject $json "mobile.ios"

# Adds the "Authorization: Bearer {{auth0_token}}" header.
CkHttp_put_AuthToken $http "{{auth0_token}}"
CkHttp_SetRequestHeader $http "Content-Type" "application/json"

set sbRequestBody [new_CkStringBuilder]

CkJsonObject_EmitSb $json $sbRequestBody

# resp is a CkHttpResponse
set resp [CkHttp_PTextSb $http "PATCH" "https://{{auth0_domain}}/api/v2/clients/:id" $sbRequestBody "utf-8" "application/json" 0 0]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkJsonObject $json
    delete_CkStringBuilder $sbRequestBody
    exit
}

puts [CkHttpResponse_get_StatusCode $resp]
puts [CkHttpResponse_bodyStr $resp]
delete_CkHttpResponse $resp


delete_CkHttp $http
delete_CkJsonObject $json
delete_CkStringBuilder $sbRequestBody

Curl Command

curl -X PATCH
	-H "Authorization: Bearer {{auth0_token}}"
	-H "Content-Type: application/json"
	-d '{
  "name": "",
  "client_secret": "",
  "logo_uri": "",
  "callbacks": [
    ""
  ],
  "allowed_origins": [
    ""
  ],
  "client_aliases": [
    ""
  ],
  "allowed_clients": [
    ""
  ],
  "allowed_logout_urls": [
    ""
  ],
  "jwt_configuration": {
    "lifetime_in_seconds": 0,
    "secret_encoded": true,
    "scopes": {},
    "alg": ""
  },
  "encryption_key": {
    "pub": "",
    "cert": "",
    "subject": ""
  },
  "sso": true,
  "custom_login_page_on": true,
  "token_endpoint_auth_method": "",
  "app_type": "",
  "is_first_party": true,
  "custom_login_page": "",
  "custom_login_page_preview": "",
  "form_template": "",
  "addons": {
    "aws": {},
    "azure_blob": {},
    "azure_sb": {},
    "rms": {},
    "mscrm": {},
    "slack": {},
    "box": {},
    "cloudbees": {},
    "concur": {},
    "dropbox": {},
    "echosign": {},
    "egnyte": {},
    "firebase": {},
    "newrelic": {},
    "office365": {},
    "salesforce": {},
    "salesforce_api": {},
    "salesforce_sandbox_api": {},
    "samlp": {},
    "layer": {},
    "sap_api": {},
    "sharepoint": {},
    "springcm": {},
    "wams": {},
    "wsfed": {},
    "zendesk": {},
    "zoom": {}
  },
  "resource_servers": [
    {
      "identifier": "",
      "scopes": [
        ""
      ]
    }
  ],
  "client_metadata": {},
  "mobile": {
    "android": {},
    "ios": {}
  }
}'
https://{{auth0_domain}}/api/v2/clients/:id

Postman Collection Item JSON

{
  "name": "Update a client",
  "request": {
    "method": "PATCH",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{auth0_token}}"
      },
      {
        "key": "Content-Type",
        "value": "application/json"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\r\n  \"name\": \"\",\r\n  \"client_secret\": \"\",\r\n  \"logo_uri\": \"\",\r\n  \"callbacks\": [\r\n    \"\"\r\n  ],\r\n  \"allowed_origins\": [\r\n    \"\"\r\n  ],\r\n  \"client_aliases\": [\r\n    \"\"\r\n  ],\r\n  \"allowed_clients\": [\r\n    \"\"\r\n  ],\r\n  \"allowed_logout_urls\": [\r\n    \"\"\r\n  ],\r\n  \"jwt_configuration\": {\r\n    \"lifetime_in_seconds\": 0,\r\n    \"secret_encoded\": true,\r\n    \"scopes\": {},\r\n    \"alg\": \"\"\r\n  },\r\n  \"encryption_key\": {\r\n    \"pub\": \"\",\r\n    \"cert\": \"\",\r\n    \"subject\": \"\"\r\n  },\r\n  \"sso\": true,\r\n  \"custom_login_page_on\": true,\r\n  \"token_endpoint_auth_method\": \"\",\r\n  \"app_type\": \"\",\r\n  \"is_first_party\": true,\r\n  \"custom_login_page\": \"\",\r\n  \"custom_login_page_preview\": \"\",\r\n  \"form_template\": \"\",\r\n  \"addons\": {\r\n    \"aws\": {},\r\n    \"azure_blob\": {},\r\n    \"azure_sb\": {},\r\n    \"rms\": {},\r\n    \"mscrm\": {},\r\n    \"slack\": {},\r\n    \"box\": {},\r\n    \"cloudbees\": {},\r\n    \"concur\": {},\r\n    \"dropbox\": {},\r\n    \"echosign\": {},\r\n    \"egnyte\": {},\r\n    \"firebase\": {},\r\n    \"newrelic\": {},\r\n    \"office365\": {},\r\n    \"salesforce\": {},\r\n    \"salesforce_api\": {},\r\n    \"salesforce_sandbox_api\": {},\r\n    \"samlp\": {},\r\n    \"layer\": {},\r\n    \"sap_api\": {},\r\n    \"sharepoint\": {},\r\n    \"springcm\": {},\r\n    \"wams\": {},\r\n    \"wsfed\": {},\r\n    \"zendesk\": {},\r\n    \"zoom\": {}\r\n  },\r\n  \"resource_servers\": [\r\n    {\r\n      \"identifier\": \"\",\r\n      \"scopes\": [\r\n        \"\"\r\n      ]\r\n    }\r\n  ],\r\n  \"client_metadata\": {},\r\n  \"mobile\": {\r\n    \"android\": {},\r\n    \"ios\": {}\r\n  }\r\n}"
    },
    "url": {
      "raw": "https://{{auth0_domain}}/api/v2/clients/:id",
      "protocol": "https",
      "host": [
        "{{auth0_domain}}"
      ],
      "path": [
        "api",
        "v2",
        "clients",
        ":id"
      ],
      "variable": [
        {
          "key": "id",
          "type": "any"
        }
      ]
    },
    "description": "<strong>Important:</strong> The <code>client_secret</code> and <code>encryption_key</code> attributes can only be updated with the <code>update:client_keys</code> scope."
  },
  "response": [
  ]
}