Auf dieser Seite Erfahren Sie, wie Sie die OAuth 2.0-Authentifizierung für benutzerdefinierte Kanäle in Adobe Journey Optimizer konfigurieren, einschließlich der Payload der Token-Anfrage, der Anmeldedatenpfade, der Token-Extraktion und des Token-Speicherorts in Versandanfragen.
Wenn Sie OAuth 2.0 als Authentifizierungstyp beim Erstellen eines benutzerdefinierten Kanals auswählen, konfigurieren Sie die Token-Anforderung, die Adobe Journey Optimizer verwendet, um ein Zugriffs-Token von Ihrem Autorisierungsserver abzurufen.
Journey Optimizer sendet die Token-Anfrage mit der endpoint-, method-, request- und policy. Anschließend extrahiert er das Zugriffs-Token mithilfe von tokenPath aus der Antwort und fügt es mithilfe von locationConfig zur Versandanfrage hinzu.
Die OAuth 2.0-Authentifizierungs-Payload konfiguriert die Anfrage an den Token-Endpunkt. Sie ist getrennt von der Nachrichten-Payload die an Ihren benutzerdefinierten Kanalversand-Endpunkt gesendet wird.
Konfigurieren der Token-Anfrage token-request
Verwenden Sie die folgenden Beispiele, um Ihre Token-Anfrage zu konfigurieren. Ersetzen Sie den Beispielendpunkt und die Werte der Anmeldeinformationen durch die von Ihrem Autorisierungs-Server erforderlichen Werte. Die headers- und queryParams-Einträge in den Beispielen sind optional: Entfernen Sie sie, wenn Ihr Token-Endpunkt sie nicht benötigt, und entfernen Sie die entsprechenden Einträge aus credentialPaths.
Beispiel für einen Formularhauptteil form-body-example
Verwenden Sie eine form Payload, wenn der Token-Endpunkt Formularfelder wie grant_type, client_id oder client_secret erwartet.
{
"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"
}
}
Für eine form Payload verwendet jeder Pfad für die Berechtigung den Formularfeldschlüssel, z. B. payload.client_secret. Schließen Sie keine content- oder Array-Indizes in den Pfad der Berechtigung ein.
JSON-Textbeispiel json-body-example
Verwenden Sie eine json Payload, wenn der Token-Endpunkt einen JSON-Anfragetext erwartet.
{
"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"
}
}
OAuth 2.0-Felder oauth2-fields
typeoauth2sein.endpoint.urimethodpost für Token-Anfragen.request.headersrequest.queryParamsrequest.payloadform und json Payloads.request.payload.includeNullValuesresponse.typejson, wenn der Token-Endpunkt eine JSON-Antwort zurückgibt.policy.timeoutInMillisecondspolicy.cachepolicy.retrycredentialPathstokenPathaccess_token oder data.access_token.locationConfiglocationConfig.keyAuthorization.locationConfig.locationheader oder queryParam.Wenn die Token-Zwischenspeicherung aktiviert ist, verwendet Journey Optimizer das OAuth-Token für die konfigurierte Cache-Dauer erneut, anstatt für jede Versandanfrage den Token-Endpunkt aufzurufen.
Identifizieren von Berechtigungsfeldern credential-paths
Verwenden Sie credentialPaths, um zu ermitteln, welche Anfragefelder Anmeldeinformationen enthalten. Wenn eine Kopfzeile oder ein Abfrageparameter eine Berechtigung enthält, geben Sie im Anfragetext deren Pfad sowie etwaige Berechtigungspfade an. Die obigen Beispiele identifizieren die Beispielkopfzeilen- und Abfrageparameterwerte als Anmeldeinformationen. Passen Sie diese Liste an Ihre Anfrage an.
header.header.sampleHeaderKeyqueryParam.queryParam.sampleQueryParamKeypayload.payload.client_secretWenden Sie die folgenden Regeln an:
- Pfade müssen mit
header,queryParamoderpayloadbeginnen und Punkte als Trennzeichen verwenden. - Verwenden Sie für
formPayloadspayload.<formFieldKey>. - Verwenden Sie für
jsonPayloads den JSON-Objektpfad, z. B.payload.client_idoderpayload.credentials.client_secret. Fügen Sie keinecontentin den Pfad ein. - Leere Pfadsegmente werden nicht unterstützt. Beispielsweise ist
payload..client_idungültig.
Verwenden Sie für einen verschachtelten JSON-Text die Punktnotation, wie in diesem Konfigurationsauszug gezeigt:
{
"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"
]
}
Extrahieren des Zugriffstokens token-path
tokenPath definiert, wo sich das Zugriffstoken in der OAuth 2.0-Token-Antwort befindet.
Legen Sie für die folgende Antwort tokenPath auf access_token fest:
{
"access_token": "example-access-token",
"token_type": "Bearer",
"expires_in": 3600
}
Legen Sie für eine verschachtelte Antwort tokenPath auf data.access_token fest:
{
"data": {
"access_token": "example-access-token"
}
}
Token zu Versandanfragen hinzufügen token-location
locationConfig definiert, wo Journey Optimizer das abgerufene Token hinzufügt, wenn der benutzerdefinierte Kanalbereitstellungs-Endpunkt aufgerufen wird.
Um das Token in der Authorization-Kopfzeile zu senden, verwenden Sie:
{
"locationConfig": {
"key": "Authorization",
"location": "header"
}
}
headerqueryParamBeschränkungen und Validierungsregeln limits
endpoint.uripolicy.timeoutInMillisecondspolicy.cache.ttlInSecondsrequest.headersrequest.queryParamsrequest.payload.type=formtokenPathcredentialPathsheader, queryParam oder payload beginnen und Punkte als Trennzeichen verwenden.Nächste Schritte 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.