{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/ConnectionScriptsOAuth2",
  "title": "ConnectionScriptsOAuth2",
  "type": "object",
  "description": "Custom scripts to transform user profile data or modify OAuth2 flow behavior",
  "additionalProperties": false,
  "properties": {
    "fetchUserProfile": {
      "type": "string",
      "description": "Custom JavaScript function to retrieve and transform user profile data from the identity provider. Called with the access token and token exchange response. Must return a user profile object. Executed in a sandboxed environment. If not provided, an empty profile object is used.",
      "minLength": 0,
      "maxLength": 51200
    },
    "getLogoutUrl": {
      "type": "string",
      "description": "Custom JavaScript function to dynamically construct the logout URL for the identity provider. Called with the request query parameters and must invoke a callback with the logout URL. Only used if 'logoutUrl' is not configured. Executed in a sandboxed environment.",
      "minLength": 0,
      "maxLength": 51200
    }
  }
}