セルフサービスソースの認証仕様の設定(バッチSDK)

認証の仕様は、Adobe Experience Platform ユーザーがソースに接続する方法を定義します。

authSpec配列には、ソースをExperience Platformに接続するために必要な認証パラメーターに関する情報が含まれています。 任意のソースで複数の異なる認証タイプをサポートできます。

認証の仕様

セルフサービスソース(バッチSDK)は、OAuth 2更新コードと基本認証をサポートしています。 OAuth 2更新コードと基本認証の使用に関するガイダンスについては、次の表を参照してください

OAuth 2更新コード

OAuth2 リフレッシュコードは、一時アクセストークンとリフレッシュトークンを生成することで、アプリケーションへの安全なアクセスを可能にする。 アクセストークンを使用すると、他の資格情報を指定することなくリソースに安全にアクセスできます。また、更新トークンを使用すると、アクセストークンの有効期限が切れると、新しいアクセストークンを生成できます。

OAuth 2更新コードの例の表示
code language-json
{
  "name": "OAuth2 Refresh Code",
  "type": "OAuth2RefreshCode",
  "spec": {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "description": "Define auth params required for connecting to generic rest using oauth2 authorization code.",
    "properties": {
      "authorizationTestUrl": {
        "description": "Authorization test url to validate accessToken.",
        "type": "string"
      },
      "clientId": {
        "description": "Client id of user account.",
        "type": "string"
      },
      "clientSecret": {
        "description": "Client secret of user account.",
        "type": "string",
        "format": "password"
      },
      "accessToken": {
        "description": "Access Token",
        "type": "string",
        "format": "password"
      },
      "refreshToken": {
        "description": "Refresh Token",
        "type": "string",
        "format": "password"
      },
      "expirationDate": {
        "description": "Date of token expiry.",
        "type": "string",
        "format": "date",
        "uiAttributes": {
          "hidden": true
        }
      },
      "accessTokenUrl": {
        "description": "Access token url to fetch access token.",
        "type": "string"
      },
      "requestParameterOverride": {
        "type": "object",
        "description": "Specify parameter to override.",
        "properties": {
          "accessTokenField": {
            "description": "Access token field name to override.",
            "type": "string"
          },
          "refreshTokenField": {
            "description": "Refresh token field name to override.",
            "type": "string"
          },
          "expireInField": {
            "description": "ExpireIn field name to override.",
            "type": "string"
          },
          "authenticationMethod": {
            "description": "Authentication method override.",
            "type": "string",
            "enum": [
              "GET",
              "POST"
            ]
          },
          "clientId": {
            "description": "ClientId field name override.",
            "type": "string"
          },
          "clientSecret": {
            "description": "ClientSecret field name override.",
            "type": "string"
          }
        }
      }
    },
    "required": [
      "accessToken"
    ]
  }
}
table 0-row-3 1-row-3 2-row-3 3-row-3 4-row-3 5-row-3 6-row-3 7-row-3 8-row-3 9-row-3 10-row-3 11-row-3 12-row-3 13-row-3 14-row-3 15-row-3 16-row-3 17-row-3 layout-auto
プロパティ 説明
authSpec.name サポートされている認証タイプの名前を表示します。 oAuth2-refresh-code
authSpec.type ソースでサポートされる認証のタイプを定義します。 oAuth2-refresh-code
authSpec.spec 認証のスキーマ、データタイプ、プロパティに関する情報が含まれます。
authSpec.spec.$schema 認証に使用するスキーマを定義します。 http://json-schema.org/draft-07/schema#
authSpec.spec.type スキーマのデータタイプを定義します。 object
authSpec.spec.properties 認証に使用される資格情報に関する情報が含まれます。
authSpec.spec.properties.description 資格情報に簡単な説明を表示します。
authSpec.spec.properties.type 資格情報のデータタイプを定義します。 string
authSpec.spec.properties.clientId アプリケーションに関連付けられているクライアント ID。 クライアント IDは、アクセストークンを取得するためにクライアントの秘密鍵と組み合わせて使用されます。
authSpec.spec.properties.clientSecret アプリケーションに関連付けられているクライアント秘密鍵。 クライアントシークレットは、アクセストークンを取得するためにクライアント IDと組み合わせて使用されます。
authSpec.spec.properties.accessToken アクセストークンは、アプリケーションへの安全なアクセスを許可します。
authSpec.spec.properties.refreshToken 更新トークンは、アクセストークンの有効期限が切れたときに、新しいアクセストークンを生成するために使用されます。
authSpec.spec.properties.expirationDate アクセストークンの有効期限を定義します。
authSpec.spec.properties.refreshTokenUrl 更新トークンの取得に使用されるURL。
authSpec.spec.properties.accessTokenUrl 更新トークンの取得に使用されるURL。
authSpec.spec.properties.requestParameterOverride 認証時に上書きする資格情報パラメーターを指定できます。
authSpec.spec.required 認証に必要な資格情報を表示します。 accessToken

基本認証

基本認証は、アカウントのユーザー名とアカウントのパスワードを組み合わせてアプリケーションにアクセスできる認証タイプです。

基本認証の例を表示
code language-json
{
  "name": "Basic Authentication",
  "type": "BasicAuthentication",
  "spec": {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "description": "defines auth params required for connecting to rest service.",
    "properties": {
      "username": {
        "description": "Username to connect rest endpoint.",
        "type": "string"
      },
      "password": {
        "description": "Password to connect rest endpoint.",
        "type": "string",
        "format": "password"
      }
    },
    "required": [
      "username",
      "password"
    ]
  }
}
table 0-row-3 1-row-3 2-row-3 3-row-3 4-row-3 5-row-3 6-row-3 7-row-3 8-row-3 9-row-3 10-row-3 layout-auto
プロパティ 説明
authSpec.name サポートされている認証タイプの名前を表示します。 Basic Authentication
authSpec.type ソースでサポートされる認証のタイプを定義します。 BasicAuthentication
authSpec.spec 認証のスキーマ、データタイプ、プロパティに関する情報が含まれます。
authSpec.spec.$schema 認証に使用するスキーマを定義します。 http://json-schema.org/draft-07/schema#
authSpec.spec.type スキーマのデータタイプを定義します。 object
authSpec.spec.description 認証タイプに固有の詳細情報を表示します。
authSpec.spec.properties 認証に使用される資格情報に関する情報が含まれます。
authSpec.spec.properties.username アプリケーションに関連付けられているアカウントユーザー名。
authSpec.spec.properties.password アプリケーションに関連付けられているアカウントパスワード。
authSpec.spec.required Experience Platformで入力する必須の値として必須フィールドを指定します。 username

API キー認証 api-key-authentication

API キー認証は、リクエストにAPI キーやその他の関連する認証パラメーターを提供することで、APIにアクセスするための安全な方法です。 特定のAPI情報に応じて、リクエストヘッダー、クエリパラメーター、本文の一部としてAPI キーを送信できます。

API キー認証を使用する場合、通常、次のパラメーターが必要です。

パラメーター
タイプ
必須
説明
host
文字列
×
リソース URL。
authKey1
文字列
API アクセスに必要な最初の認証キー。 通常、リクエストヘッダーまたはクエリパラメーターで送信されます。
authKey2
文字列
オプション
2番目の認証キー。 必要に応じて、このキーはリクエストをさらに検証するためによく使用されます。
authKeyN
文字列
オプション
必要に応じて使用できる追加の認証変数ですが、APIです。
API キー認証の表示
code language-json
{
  "name": "API Key Authentication",
  "type": "KeyBased",
  "spec": {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "description": "Define authentication parameters required for API access",
    "properties": {
      "host": {
        "type": "string",
        "description": "Enter resource URL host path"
      },
      "authKey1": {
        "type": "string",
        "format": "password",
        "title": "Authentication Key 1",
        "description": "Primary authentication key for accessing the API",
        "restAttributes": {
          "headerParamName": "X-Auth-Key1"
        }
      },
      "authKey2": {
        "type": "string",
        "format": "password",
        "title": "Authentication Key 2",
        "description": "Secondary authentication key, if required",
        "restAttributes": {
          "headerParamName": "X-Auth-Key2"
        }
      },
      ..
      ..
      "authKeyN": {
        "type": "string",
        "format": "password",
        "title": "Additional Authentication Key",
        "description": "Additional authentication keys as needed by the API",
        "restAttributes": {
          "headerParamName": "X-Auth-KeyN"
        }
      }
    },
    "required": [
      "authKey1"
    ]
  }
}

認証動作

restAttributes パラメーターを使用して、API キーをリクエストに含める方法を定義できます。 例えば、次の例では、headerParamName属性は、X-Auth-Key1をヘッダーとして送信する必要があることを示しています。

  "restAttributes": {
      "headerParamName": "X-Auth-Key1"
  }

各認証キー(authKey1authKey2など) restAttributesに関連付けて、リクエストとして送信する方法を指定できます。

authKey1"headerParamName": "X-Auth-Key1"がある場合。 つまり、リクエストヘッダーにはX-Auth-Key:{YOUR_AUTH_KEY1}を含める必要があります。 さらに、キー名とheaderParamNameは必ずしも同じである必要はありません。 次に例を示します。

  • authKey1にはheaderParamName: X-Custom-Auth-Keyを指定できます。 つまり、リクエストヘッダーではauthKey1ではなくX-Custom-Auth-Keyが使用されます。
  • 逆に、authKey1にはheaderParamName: authKey1を指定できます。 つまり、リクエストヘッダー名は変更されません。

API形式の例

GET /data?X-Auth-Key1={YOUR_AUTH_KEY1}&X-Auth-Key2={YOUR_AUTH_KEY2}

認証仕様の例

次に、MailChimp Members ソースを使用して完了した認証仕様の例を示します。

認証仕様の例を表示
code language-json
  "authSpec": [
    {
      "name": "OAuth2 Refresh Code",
      "type": "OAuth2RefreshCode",
      "spec": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "type": "object",
        "description": "Define auth params required for connecting to generic rest using oauth2 authorization code.",
        "properties": {
          "authorizationTestUrl": {
            "description": "Authorization test url to validate accessToken.",
            "type": "string"
          },
          "accessToken": {
            "description": "Access Token of mailChimp endpoint.",
            "type": "string",
            "format": "password"
          }
        },
        "required": [
          "accessToken"
        ]
      }
    },
    {
      "name": "Basic Authentication",
      "type": "BasicAuthentication",
      "spec": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "type": "object",
        "description": "defines auth params required for connecting to rest service.",
        "properties": {
          "username": {
            "description": "Username to connect mailChimp endpoint.",
            "type": "string"
          },
          "password": {
            "description": "Password to connect mailChimp endpoint.",
            "type": "string",
            "format": "password"
          }
        },
        "required": [
          "username",
          "password"
        ]
      }
    }
  ],

次の手順

認証仕様を入力したら、Experience Platformに統合するソースのソース仕様の設定に進みます。 詳しくは、​ ソース仕様の設定に関するドキュメントを参照してください。

recommendation-more-help
experience-platform-help-sources