Sur cette page : découvrez comment configurer l’authentification OAuth 2.0 pour les canaux personnalisés dans Adobe Journey Optimizer, y compris la payload de la requête de jeton, les chemins d’accès aux informations d’identification, l’extraction du jeton et l’emplacement du jeton dans les requêtes de diffusion.
Lorsque vous sélectionnez OAuth 2.0 comme type d’authentification lors de la création d’un canal personnalisé, configurez la demande de jeton que Adobe Journey Optimizer utilise pour récupérer un jeton d’accès à partir de votre serveur d’autorisation.
Journey Optimizer envoie la demande de jeton à l’aide de la configuration endpoint, method, request et policy. Il extrait ensuite le jeton d’accès de la réponse à l’aide de tokenPath et l’ajoute à la demande de diffusion à l’aide de locationConfig.
La payload d’authentification OAuth 2.0 configure la requête au point d’entrée token. Elle est distincte de la payload du message envoyée à votre point d’entrée de diffusion de canal personnalisé.
Configurer la demande de jeton token-request
Utilisez les exemples suivants pour configurer votre requête de jeton. Remplacez les exemples de valeurs de point d’entrée et d’informations d’identification par celles requises par votre serveur d’autorisations. Les entrées headers et queryParams des exemples sont facultatives : supprimez-les si le point d’entrée du jeton ne les requiert pas, puis supprimez les entrées correspondantes de credentialPaths.
Exemple de corps de formulaire form-body-example
Utilisez une payload form lorsque le point d’entrée du jeton attend des champs de formulaire tels que grant_type, client_id ou 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"
}
}
Pour une payload form, chaque chemin d’accès aux informations d’identification utilise la clé du champ de formulaire, par exemple payload.client_secret. N’incluez pas d’index de content ou de tableau dans le chemin d’accès des informations d’identification.
Exemple de corps JSON json-body-example
Utilisez une payload json lorsque le point d’entrée du jeton attend un corps de requête 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"
}
}
Champs OAuth 2.0 oauth2-fields
typeoauth2.endpoint.urimethodpost pour les demandes de jeton.request.headersrequest.queryParamsrequest.payloadform et json.request.payload.includeNullValuesresponse.typejson lorsque le point d’entrée du jeton renvoie une réponse JSON.policy.timeoutInMillisecondspolicy.cachepolicy.retrycredentialPathstokenPathaccess_token ou data.access_token.locationConfiglocationConfig.keyAuthorization.locationConfig.locationheader ou queryParam.Lorsque la mise en cache des jetons est activée, Journey Optimizer réutilise le jeton OAuth pour la durée de mise en cache configurée au lieu d’appeler le point d’entrée des jetons pour chaque demande de diffusion.
Identification des champs d’identification credential-paths
Utilisez des credentialPaths pour identifier les champs de requête contenant des informations d’identification. Si un en-tête ou un paramètre de requête contient des informations d’identification, incluez son chemin ainsi que tous les chemins d’accès aux informations d’identification dans le corps de la requête. Les exemples ci-dessus identifient les exemples de valeurs d’en-tête et de paramètres de requête en tant qu’informations d’identification. Ajustez cette liste pour qu’elle corresponde à votre requête.
header.header.sampleHeaderKeyqueryParam.queryParam.sampleQueryParamKeypayload.payload.client_secretAppliquez les règles suivantes :
- Les chemins doivent commencer par des
header, desqueryParamou despayloadet utiliser des points comme séparateurs. - Pour les payloads
form, utilisezpayload.<formFieldKey>. - Pour les payloads
json, utilisez le chemin d’accès de l’objet JSON, tel quepayload.client_idoupayload.credentials.client_secret. N’incluez pascontentdans le chemin d’accès. - Les segments de chemin vides ne sont pas pris en charge. Par exemple,
payload..client_idn’est pas valide.
Pour un corps JSON imbriqué, utilisez la notation par points comme illustré dans cet extrait de configuration :
{
"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"
]
}
Extraire le jeton d’accès token-path
tokenPath définit l’emplacement du jeton d’accès dans la réponse du jeton OAuth 2.0.
Pour la réponse suivante, définissez tokenPath sur access_token :
{
"access_token": "example-access-token",
"token_type": "Bearer",
"expires_in": 3600
}
Pour une réponse imbriquée, définissez tokenPath sur data.access_token :
{
"data": {
"access_token": "example-access-token"
}
}
Ajouter le jeton aux demandes de diffusion token-location
locationConfig définit l’emplacement où Journey Optimizer ajoute le jeton récupéré lors de l’appel du point d’entrée de diffusion du canal personnalisé.
Pour envoyer le jeton dans l’en-tête Authorization, utilisez :
{
"locationConfig": {
"key": "Authorization",
"location": "header"
}
}
headerqueryParamLimites et règles de validation limits
endpoint.uripolicy.timeoutInMillisecondspolicy.cache.ttlInSecondsrequest.headersrequest.queryParamsrequest.payload.type=formtokenPathcredentialPathsheader, queryParam ou payload et utiliser des points comme séparateurs.Étapes suivantes next-steps
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
typetooauth2and usepostfor 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
formandjsonpayloads; choose the format expected by your authorization server. - Credential paths must start with
header,queryParam, orpayload, 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
contentor form array indexes in credential paths. - Supported token locations are
headerandqueryParam. - 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
tokenPathis 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) withtokenPath(access token field in the token response) - Do not confuse:
request.headersandrequest.queryParams(values sent to the token endpoint) withlocationConfig(where the retrieved token is added to delivery requests)
FAQ:
- Q: When should I use a form or JSON payload? - Use
formwhen the token endpoint expects form fields, andjsonwhen 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, withoutcontentor 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
tokenPathto the response field path, for example,data.access_token. - Q: Where can Journey Optimizer add the token to delivery requests? - Set
locationConfig.locationtoheaderorqueryParamandlocationConfig.keyto 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.