Nesta página: saiba como configurar a autenticação OAuth 2.0 para canais personalizados no Adobe Journey Optimizer, incluindo a carga de solicitação de token, caminhos de credencial, extração de token e localização de token em solicitações de entrega.
Ao selecionar OAuth 2.0 como o tipo de autenticação ao criar um canal personalizado, configure a solicitação de token que o Adobe Journey Optimizer usa para recuperar um token de acesso do servidor de autorização.
O Journey Optimizer envia a solicitação de token usando a configuração endpoint, method, request e policy. Em seguida, ele extrai o token de acesso da resposta usando tokenPath e o adiciona à solicitação de entrega usando locationConfig.
A carga de autenticação do OAuth 2.0 configura a solicitação para o ponto de extremidade do token. Ela é separada da carga de mensagem enviada para o ponto de extremidade de entrega de canal personalizado.
Configurar a solicitação de token token-request
Use os exemplos a seguir para configurar sua solicitação de token. Substitua o endpoint de exemplo e os valores de credencial pelos exigidos pelo servidor de autorização. As entradas headers e queryParams nos exemplos são opcionais: remova-as se o ponto de extremidade do token não as exigir e remova as entradas correspondentes de credentialPaths.
Exemplo de corpo de formulário form-body-example
Use uma carga de form quando o ponto de extremidade do token esperar campos de formulário como 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"
}
}
Para uma carga form, cada caminho de credencial usa a chave do campo de formulário, por exemplo, payload.client_secret. Não inclua content ou índices de matriz no caminho da credencial.
Exemplo de corpo JSON json-body-example
Use uma carga json quando o ponto de extremidade do token esperar um corpo de solicitação 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 do OAuth 2.0 oauth2-fields
typeoauth2.endpoint.urimethodpost para solicitações de token.request.headersrequest.queryParamsrequest.payloadform e json.request.payload.includeNullValuesresponse.typejson quando o ponto de extremidade do token retornar uma resposta JSON.policy.timeoutInMillisecondspolicy.cachepolicy.retrycredentialPathstokenPathaccess_token ou data.access_token.locationConfiglocationConfig.keyAuthorization.locationConfig.locationheader ou queryParam.Quando o armazenamento em cache do token é ativado, o Journey Optimizer reutiliza o token OAuth pela duração do cache configurado, em vez de chamar o endpoint do token para cada solicitação de entrega.
Identificar campos de credencial credential-paths
Use credentialPaths para identificar quais campos de solicitação contêm credenciais. Se um cabeçalho ou parâmetro de consulta contiver uma credencial, inclua o caminho dele, bem como quaisquer caminhos de credencial no corpo da solicitação. Os exemplos acima identificam o cabeçalho de amostra e os valores de parâmetro de consulta como credenciais; ajuste essa lista para corresponder à sua solicitação.
header.header.sampleHeaderKeyqueryParam.queryParam.sampleQueryParamKeypayload.payload.client_secretAplique as seguintes regras:
- Os caminhos devem começar com
header,queryParamoupayloade usar pontos como separadores. - Para cargas de
form, usepayload.<formFieldKey>. - Para cargas de
json, use o caminho de objeto JSON, comopayload.client_idoupayload.credentials.client_secret. Não incluacontentno caminho. - Não há suporte para segmentos de caminho vazios. Por exemplo,
payload..client_idé inválido.
Para um corpo JSON aninhado, use a notação de pontos conforme mostrado neste trecho de configuração:
{
"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"
]
}
Extrair o token de acesso token-path
tokenPath define onde o token de acesso está localizado na resposta do token OAuth 2.0.
Para a seguinte resposta, defina tokenPath como access_token:
{
"access_token": "example-access-token",
"token_type": "Bearer",
"expires_in": 3600
}
Para uma resposta aninhada, defina tokenPath como data.access_token:
{
"data": {
"access_token": "example-access-token"
}
}
Adicionar o token às solicitações de entrega token-location
locationConfig define onde o Journey Optimizer adiciona o token recuperado ao chamar o ponto de extremidade de entrega do canal personalizado.
Para enviar o token no cabeçalho Authorization, use:
{
"locationConfig": {
"key": "Authorization",
"location": "header"
}
}
headerqueryParamLimites e regras de validação limits
endpoint.uripolicy.timeoutInMillisecondspolicy.cache.ttlInSecondsrequest.headersrequest.queryParamsrequest.payload.type=formtokenPathcredentialPathsheader, queryParam ou payload e usar pontos como separadores.Próximas etapas 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.