Bad Request Payload Validation Error Missing Required Property Scripts

Overview

This article explains the payload validation error that occurs when making calls to the Auth0 Management API regarding connection options. When performing this action, the following error is returned:

 

Response Code: 400 Response Body: "statusCode": 400, "error": "Bad Request" "message": "Payload validation error: 'Missing required property: scripts' on property options." "errorCode": "invalid_body".

 

Test endpoint

Applies To

  • Auth0 Management API

  • Connections

Cause

The error occurs because the scripts property is missing from the options object in the request payload.

Solution

  1. Go to the Get a connection endpoint.

  2. Retrieve the connection details. The response resembles the following example:

{
  "id": "con_****",
  "options": {
    "scope": "",
    "scripts": {
      "fetchUserProfile": "function(accessToken, ctx, cb) {\n    const profile = {};\n    // Call OAuth2 API with the accessToken and create the profile\n    cb(null, profile);\n  }"
    },
  1. Copy the scripts object from the response.

  2. Go to the Update a connection endpoint.

  3. Paste the scripts object inside options in the request body as shown below:

{
  "display_name": "YourDisplayName",
  "options": {
    "icon_url": "https://yourlogo.svg",
    "scripts": {
      "fetchUserProfile": "YOUR_COPIED_CODE_HERE"
    }
  }
}

Recommended content

No recommended content found...