Chilkat Online Tools

DataFlex / Auth0 Management API / Create a client

Back to Collection Items

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vJson
    Handle hoJson
    Variant vResp
    Handle hoResp
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    // 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": [
    //     ""
    //   ],
    //   "token_endpoint_auth_method": "",
    //   "app_type": "",
    //   "is_first_party": true,
    //   "jwt_configuration": {
    //     "lifetime_in_seconds": 0,
    //     "secret_encoded": true,
    //     "scopes": {},
    //     "alg": ""
    //   },
    //   "encryption_key": {
    //     "pub": "",
    //     "cert": ""
    //   },
    //   "sso": true,
    //   "custom_login_page_on": true,
    //   "custom_login_page": "",
    //   "custom_login_page_preview": "",
    //   "form_template": "",
    //   "is_heroku_app": true,
    //   "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": {}
    //   }
    // }

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get ComUpdateString Of hoJson "name" "" To iSuccess
    Get ComUpdateString Of hoJson "client_secret" "" To iSuccess
    Get ComUpdateString Of hoJson "logo_uri" "" To iSuccess
    Get ComUpdateString Of hoJson "callbacks[0]" "" To iSuccess
    Get ComUpdateString Of hoJson "allowed_origins[0]" "" To iSuccess
    Get ComUpdateString Of hoJson "client_aliases[0]" "" To iSuccess
    Get ComUpdateString Of hoJson "allowed_clients[0]" "" To iSuccess
    Get ComUpdateString Of hoJson "allowed_logout_urls[0]" "" To iSuccess
    Get ComUpdateString Of hoJson "token_endpoint_auth_method" "" To iSuccess
    Get ComUpdateString Of hoJson "app_type" "" To iSuccess
    Get ComUpdateBool Of hoJson "is_first_party" True To iSuccess
    Get ComUpdateInt Of hoJson "jwt_configuration.lifetime_in_seconds" 0 To iSuccess
    Get ComUpdateBool Of hoJson "jwt_configuration.secret_encoded" True To iSuccess
    Get ComUpdateNewObject Of hoJson "jwt_configuration.scopes" To iSuccess
    Get ComUpdateString Of hoJson "jwt_configuration.alg" "" To iSuccess
    Get ComUpdateString Of hoJson "encryption_key.pub" "" To iSuccess
    Get ComUpdateString Of hoJson "encryption_key.cert" "" To iSuccess
    Get ComUpdateBool Of hoJson "sso" True To iSuccess
    Get ComUpdateBool Of hoJson "custom_login_page_on" True To iSuccess
    Get ComUpdateString Of hoJson "custom_login_page" "" To iSuccess
    Get ComUpdateString Of hoJson "custom_login_page_preview" "" To iSuccess
    Get ComUpdateString Of hoJson "form_template" "" To iSuccess
    Get ComUpdateBool Of hoJson "is_heroku_app" True To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.aws" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.azure_blob" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.azure_sb" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.rms" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.mscrm" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.slack" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.box" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.cloudbees" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.concur" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.dropbox" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.echosign" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.egnyte" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.firebase" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.newrelic" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.office365" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.salesforce" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.salesforce_api" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.salesforce_sandbox_api" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.samlp" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.layer" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.sap_api" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.sharepoint" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.springcm" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.wams" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.wsfed" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.zendesk" To iSuccess
    Get ComUpdateNewObject Of hoJson "addons.zoom" To iSuccess
    Get ComUpdateString Of hoJson "resource_servers[0].identifier" "" To iSuccess
    Get ComUpdateString Of hoJson "resource_servers[0].scopes[0]" "" To iSuccess
    Get ComUpdateNewObject Of hoJson "client_metadata" To iSuccess
    Get ComUpdateNewObject Of hoJson "mobile.android" To iSuccess
    Get ComUpdateNewObject Of hoJson "mobile.ios" To iSuccess

    // Adds the "Authorization: Bearer {{auth0_token}}" header.
    Set ComAuthToken Of hoHttp To "{{auth0_token}}"
    Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"

    Get pvComObject of hoJson to vJson
    Get ComPostJson3 Of hoHttp "https://{{auth0_domain}}/api/v2/clients" "application/json" vJson To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComStatusCode Of hoResp To iTemp1
    Showln iTemp1
    Get ComBodyStr Of hoResp To sTemp1
    Showln sTemp1
    Send Destroy of hoResp


End_Procedure

Curl Command

curl -X POST
	-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": [
    ""
  ],
  "token_endpoint_auth_method": "",
  "app_type": "",
  "is_first_party": true,
  "jwt_configuration": {
    "lifetime_in_seconds": 0,
    "secret_encoded": true,
    "scopes": {},
    "alg": ""
  },
  "encryption_key": {
    "pub": "",
    "cert": ""
  },
  "sso": true,
  "custom_login_page_on": true,
  "custom_login_page": "",
  "custom_login_page_preview": "",
  "form_template": "",
  "is_heroku_app": true,
  "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

Postman Collection Item JSON

{
  "name": "Create a client",
  "request": {
    "method": "POST",
    "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  \"token_endpoint_auth_method\": \"\",\r\n  \"app_type\": \"\",\r\n  \"is_first_party\": true,\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  },\r\n  \"sso\": true,\r\n  \"custom_login_page_on\": true,\r\n  \"custom_login_page\": \"\",\r\n  \"custom_login_page_preview\": \"\",\r\n  \"form_template\": \"\",\r\n  \"is_heroku_app\": true,\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",
      "protocol": "https",
      "host": [
        "{{auth0_domain}}"
      ],
      "path": [
        "api",
        "v2",
        "clients"
      ]
    },
    "description": "Creates a new client application. The samples on the right show every attribute that can be used."
  },
  "response": [
  ]
}