Bad Request Payload Validation Error Missing Required Property Scripts
Last Updated:
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".
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
-
Go to the Get a connection endpoint.
-
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 }"
},
-
Copy the
scriptsobject from the response. -
Go to the Update a connection endpoint.
-
Paste the
scriptsobject insideoptionsin the request body as shown below:
{
"display_name": "YourDisplayName",
"options": {
"icon_url": "https://yourlogo.svg",
"scripts": {
"fetchUserProfile": "YOUR_COPIED_CODE_HERE"
}
}
}