Configuración de la autenticación OAuth 2.0 custom-channel-oauth2

En esta página: Obtenga información sobre cómo configurar la autenticación OAuth 2.0 para canales personalizados en Adobe Journey Optimizer, incluida la carga útil de solicitud de token, las rutas de credenciales, la extracción de token y la ubicación de token en las solicitudes de envío.

Cuando seleccione OAuth 2.0 como tipo de autenticación al crear un canal personalizado, configure la solicitud de token que utiliza Adobe Journey Optimizer para recuperar un token de acceso de su servidor de autorización.

Journey Optimizer envía la solicitud de token utilizando la configuración endpoint, method, request y policy. Luego extrae el token de acceso de la respuesta usando tokenPath y lo agrega a la solicitud de entrega usando locationConfig.

La carga de autenticación OAuth 2.0 configura la solicitud para el extremo de token. Es independiente de la carga útil del mensaje que se envió al extremo de envío del canal personalizado.

Configuración de la solicitud de token token-request

Utilice los siguientes ejemplos para configurar la solicitud de token. Reemplace los valores de extremo y credencial de ejemplo por los requeridos por el servidor de autorización. Las entradas headers y queryParams de los ejemplos son opcionales: elimínelas si el extremo del token no las requiere y quite las entradas coincidentes de credentialPaths.

Ejemplo del cuerpo del formulario form-body-example

Utilice una carga útil form cuando el extremo del token espere campos de formulario como grant_type, client_id o client_secret.

{
  "type": "oauth2",
  "endpoint": {
    "uri": "https://auth.example.com/oauth/token"
  },
  "method": "post",
  "request": {
    "headers": [
      {
        "key": "sampleHeaderKey",
        "value": "sampleHeaderValue"
      }
    ],
    "queryParams": [
      {
        "key": "sampleQueryParamKey",
        "value": "sampleQueryParamValue"
      }
    ],
    "payload": {
      "type": "form",
      "content": [
        {
          "key": "grant_type",
          "value": "client_credentials"
        },
        {
          "key": "client_id",
          "value": "your-client-id"
        },
        {
          "key": "client_secret",
          "value": "your-client-secret"
        }
      ],
      "includeNullValues": false
    }
  },
  "response": {
    "type": "json"
  },
  "policy": {
    "timeoutInMilliseconds": 30000,
    "cache": {
      "enabled": true,
      "ttlInSeconds": 300
    },
    "retry": {
      "enabled": false,
      "maxRetryCount": 3
    }
  },
  "credentialPaths": [
    "header.sampleHeaderKey",
    "queryParam.sampleQueryParamKey",
    "payload.client_id",
    "payload.client_secret"
  ],
  "tokenPath": "access_token",
  "locationConfig": {
    "key": "Authorization",
    "location": "header"
  }
}

Para una carga útil de form, cada ruta de credenciales utiliza la clave del campo de formulario, por ejemplo, payload.client_secret. No incluya content o índices de matriz en la ruta de credenciales.

Ejemplo de cuerpo de JSON json-body-example

Utilice una carga útil json cuando el extremo del token espere un cuerpo de solicitud JSON.

{
  "type": "oauth2",
  "endpoint": {
    "uri": "https://auth.example.com/oauth/token"
  },
  "method": "post",
  "request": {
    "headers": [
      {
        "key": "sampleHeaderKey",
        "value": "sampleHeaderValue"
      }
    ],
    "queryParams": [
      {
        "key": "sampleQueryParamKey",
        "value": "sampleQueryParamValue"
      }
    ],
    "payload": {
      "type": "json",
      "content": {
        "grant_type": "client_credentials",
        "client_id": "your-client-id",
        "client_secret": "your-client-secret"
      },
      "includeNullValues": false
    }
  },
  "response": {
    "type": "json"
  },
  "policy": {
    "timeoutInMilliseconds": 30000,
    "cache": {
      "enabled": true,
      "ttlInSeconds": 300
    },
    "retry": {
      "enabled": false,
      "maxRetryCount": 3
    }
  },
  "credentialPaths": [
    "header.sampleHeaderKey",
    "queryParam.sampleQueryParamKey",
    "payload.client_id",
    "payload.client_secret"
  ],
  "tokenPath": "access_token",
  "locationConfig": {
    "key": "Authorization",
    "location": "header"
  }
}

Campos de OAuth 2.0 oauth2-fields

Campo
Descripción
type
Debe ser oauth2.
endpoint.uri
URL HTTPS del extremo del token de OAuth 2.0.
method
Método HTTP utilizado para llamar al extremo del token. Usar post para solicitudes de token.
request.headers
Encabezados opcionales enviados al extremo del token.
request.queryParams
Parámetros de consulta opcionales anexados a la dirección URL del extremo del token.
request.payload
Cuerpo de solicitud de token. Admite form y json cargas útiles.
request.payload.includeNullValues
Define si los campos con un valor nulo se incluyen en el cuerpo de solicitud de token.
response.type
Formato de respuesta. Utilice json cuando el extremo del token devuelva una respuesta JSON.
policy.timeoutInMilliseconds
Tiempo máximo de espera para la respuesta del extremo de token.
policy.cache
Define si el token de OAuth se almacena en caché y durante cuánto tiempo.
policy.retry
Configuración de reintentos opcional para errores de extremo de token.
credentialPaths
Rutas para solicitar campos que contienen credenciales. Estos campos se tratan como credenciales y se pueden administrar de forma segura.
tokenPath
Ruta separada por puntos al token de acceso en la respuesta de OAuth, por ejemplo, access_token o data.access_token.
locationConfig
Define dónde se agrega el token recuperado a la solicitud de envío.
locationConfig.key
Nombre del encabezado o parámetro de consulta que lleva el token, por ejemplo, Authorization.
locationConfig.location
Donde se agrega el token: header o queryParam.

Cuando el almacenamiento en caché de tokens está habilitado, Journey Optimizer vuelve a utilizar el token de OAuth durante la duración de caché configurada en lugar de llamar al extremo de token para cada solicitud de entrega.

Identificar campos de credenciales credential-paths

Use credentialPaths para identificar qué campos de solicitud contienen credenciales. Si un encabezado o parámetro de consulta contiene una credencial, incluya su ruta, así como cualquier ruta de credencial, en el cuerpo de la solicitud. Los ejemplos anteriores identifican el encabezado de muestra y los valores de parámetros de consulta como credenciales; ajuste esta lista para que coincida con la solicitud.

Prefijo
Se usa para
Ejemplo
header.
Credenciales pasadas en encabezados de solicitud.
header.sampleHeaderKey
queryParam.
Credencial pasada en parámetros de consulta.
queryParam.sampleQueryParamKey
payload.
Credencial pasada en el cuerpo de la solicitud.
payload.client_secret

Aplique las siguientes reglas:

  • Las rutas deben comenzar con header, queryParam o payload y usar puntos como separadores.
  • Para form cargas, use payload.<formFieldKey>.
  • Para json cargas útiles, utilice la ruta de objeto JSON, como payload.client_id o payload.credentials.client_secret. No incluya content en la ruta.
  • No se admiten segmentos de ruta vacíos. Por ejemplo, payload..client_id no es válido.

Para un cuerpo JSON anidado, utilice la notación de puntos como se muestra en este extracto de configuración:

{
  "request": {
    "payload": {
      "type": "json",
      "content": {
        "credentials": {
          "client_id": "your-client-id",
          "client_secret": "your-client-secret"
        }
      },
      "includeNullValues": false
    }
  },
  "credentialPaths": [
    "payload.credentials.client_id",
    "payload.credentials.client_secret"
  ]
}

Extraer el token de acceso token-path

tokenPath define dónde se encuentra el token de acceso en la respuesta de token de OAuth 2.0.

Para la siguiente respuesta, establezca tokenPath en access_token:

{
  "access_token": "example-access-token",
  "token_type": "Bearer",
  "expires_in": 3600
}

Para una respuesta anidada, establezca tokenPath en data.access_token:

{
  "data": {
    "access_token": "example-access-token"
  }
}

Añadir el token a las solicitudes de entrega token-location

locationConfig define dónde Journey Optimizer agrega el token recuperado al llamar al extremo de entrega de canal personalizado.

Para enviar el token en el encabezado Authorization, utilice:

{
  "locationConfig": {
    "key": "Authorization",
    "location": "header"
  }
}
Ubicación
Descripción
header
Agrega el token como un encabezado HTTP.
queryParam
Agrega el token como parámetro de consulta.

Límites y reglas de validación limits

Campo
Límite
endpoint.uri
Debe ser una dirección URL HTTPS absoluta con un host que no esté vacío. Longitud máxima: 2048 caracteres.
policy.timeoutInMilliseconds
Mínimo: 300 ms. Máximo: 60000 ms.
policy.cache.ttlInSeconds
Se aplica cuando la caché está habilitada. mínimo: 300 segundos. Máximo: 3600 segundos.
request.headers
50 encabezados como máximo. Longitud de la clave del encabezado: de 1 a 100 caracteres. Valor máximo del encabezado: 8192 caracteres.
request.queryParams
50 parámetros de consulta como máximo. Longitud de la clave del parámetro de consulta: de 1 a 100 caracteres. Valor máximo del parámetro de consulta: 8192 caracteres.
request.payload.type=form
50 campos de formulario como máximo. Longitud de la clave del formulario: 1-100 caracteres. No se permiten claves de formulario duplicadas.
Valores de credencial
1-1024 caracteres.
tokenPath
Debe ser una ruta válida separada por puntos. Solo se permite un valor vacío cuando toda la respuesta es el token.
credentialPaths
Debe comenzar por header, queryParam o payload y usar puntos como separadores.

Próximos pasos next-steps

AI Knowledge Reference

This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.

For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.

  • TL;DR: Configure OAuth 2.0 authentication for a custom channel by defining the token endpoint request, identifying credential fields, extracting the access token from the response, and specifying where to add it to delivery requests.

Intents:

  • Configure OAuth 2.0 authentication when creating a custom channel or managing API credentials
  • Choose a form or JSON body for the token endpoint request
  • Identify credential fields in headers, query parameters, and request bodies
  • Extract an access token from a top-level or nested response field
  • Add the retrieved token to a delivery request header or query parameter
  • Understand token caching and authentication configuration limits

Glossary:

  • Token endpoint: The authorization server endpoint that Journey Optimizer calls to retrieve an access token
  • Authentication payload: The configuration of the OAuth 2.0 token request, separate from the message payload sent to the delivery endpoint (product-specific)
  • Credential paths: The paths identifying request fields that contain credentials, configured through credentialPaths (product-specific)
  • Token path: The dot-separated path to the access token in the token endpoint response, configured through tokenPath (product-specific)
  • Token location configuration: The delivery request header or query parameter to which the retrieved token is added, configured through locationConfig (product-specific)

Guardrails:

  • Set the authentication configuration type to oauth2 and use post for token requests.
  • The token endpoint must be an absolute HTTPS URL with a non-empty host and a maximum length of 2048 characters.
  • Token request bodies support form and json payloads; choose the format expected by your authorization server.
  • Credential paths must start with header, queryParam, or payload, use dots as separators, and contain no empty path segments.
  • Form credential paths use the form field key. JSON credential paths use the JSON object path. Do not include content or form array indexes in credential paths.
  • Supported token locations are header and queryParam.
  • The token endpoint timeout must be between 300 and 60000 milliseconds.
  • When token caching is enabled, the cache duration must be between 300 and 3600 seconds. Journey Optimizer reuses the token for the configured duration instead of retrieving a token for every delivery request.
  • Credential values must contain between 1 and 1024 characters.
  • An empty tokenPath is allowed only when the entire response is the token.

Terminology:

  • Canonical name: OAuth 2.0 authentication - variants: OAuth 2.0 authentication payload, OAuth token request configuration
  • Do not confuse: “authentication payload” (configuration for retrieving an access token) with “message payload” (content sent to the custom channel delivery endpoint)
  • Do not confuse: credentialPaths (credential fields in the token request) with tokenPath (access token field in the token response)
  • Do not confuse: request.headers and request.queryParams (values sent to the token endpoint) with locationConfig (where the retrieved token is added to delivery requests)

FAQ:

  • Q: When should I use a form or JSON payload? - Use form when the token endpoint expects form fields, and json when it expects a JSON request body.
  • Q: How do I identify a client secret in a form body? - Use the form field key, for example, payload.client_secret, without content or an array index.
  • Q: How do I identify credentials in a nested JSON body? - Use dot notation, for example, payload.credentials.client_secret.
  • Q: How do I extract a token from a nested response? - Set tokenPath to the response field path, for example, data.access_token.
  • Q: Where can Journey Optimizer add the token to delivery requests? - Set locationConfig.location to header or queryParam and locationConfig.key to the header or query parameter name.
  • Q: Does Journey Optimizer retrieve a token for every delivery request? - When caching is enabled, it reuses the token for the configured cache duration.
recommendation-more-help
journey-optimizer-help