署名付き HMAC トークンを生成する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
セグメント リダイレクトの連続配信広告を使って行われた各セグメント リクエストには、
認証用の HMAC 署名付きトークン(使用していない場合)
早期広告ブレーク通知。
このトークンは広告ブレークごとに 1 回計算され、すべてのストリームで共有できます
あります。
トークン パラメータを収集する
現在のミッドロール挿入点から次の情報を収集して、
トークン本文です。
トークン パラメータ
|
custom_asset_key
|
必須
|
Google アド マネージャーのカスタムのライブ配信アセットキー。
|
cust_params
|
省略可
|
カスタム ターゲティング パラメータ。cust_params をご覧ください。
|
exp
|
必須
|
このトークンの有効期限のタイムスタンプ(秒単位)。
|
network_code
|
必須
|
このネットワークのアド マネージャー 360 ネットワーク コード。
|
pod_id
|
必須
|
ミッドロール挿入点の識別子。で始まる整数を指定してください
1 で、ミッドロール挿入点ごとに 1 ずつ増加します。
<ph type="x-smartling-placeholder"></ph>
この値は、同じ時間枠内で同じ広告ブレークを表示するすべてのユーザー間で同じである必要があります
クリックします。
|
pd
|
時間指定なしのミッドロール挿入点が有効になっているイベントを除き必須。
|
ミッドロール挿入点の再生時間(ミリ秒単位)。以下で呼ぶ。
ad_pod_duration 。
|
scte35
|
省略可
|
Base64 でエンコードされた SCTE-35 信号。お客様の責任において
確認することです。正しくない場合は、次の宛先に
レスポンスの X-Ad-Manager-Dai-Warning HTTP ヘッダーと
シグナルはそのまま引き継がれて
ミッドロール挿入点が作成されます詳しくは、サポートされている
広告マーカーをご覧ください。
|
トークン文字列を作成
各パラメータをアルファベット順に name=value
の形式でリストします。
名前と値のペアをチルダ(~
)で区切って指定します。
値のないオプション パラメータは、空の文字列で配置できる
値を削除するか、完全に削除します。
custom_asset_key={custom_asset_key}~exp={expiration}~network_code={network_code}~pd={pod_duration}~pod_id={ad_pod_index}~scte35={scte35_message}
HMAC 署名を生成する
HMAC 署名は、16 進数形式のトークン文字列の SHA-256 ハッシュです。「
秘密鍵は
HMAC 認証キー
関連付けられたクリエイティブが表示されます
署名トークン文字列
生成されたら、HMAC 署名を次のトークン文字列に追加します。
形式
~hmac={HMAC signature}
URL エンコード トークン文字列
このトークンは URL パラメータとして渡されるため、安全を確保するために URL エンコードする必要があります。
例 1
未使用のオプション パラメータが空になっている例を次に示します。
使用します。
トークン文字列
custom_asset_key=iYdOkYZdQ1KFULXSN0Gi7g~cust_params=~exp=1489680000~network_code=6062~pd=180000~pod_id=5~scte35=
秘密鍵
A7490591290583E4B93189DEE7E287C299FC686872ABC7ADC9F9F536443505F
HMAC 署名
86d7e5f8c96fe4c83141d764df376ae14a0e2066f2e6b2ccfb9e1e2d3c869a88
署名付きトークン
custom_asset_key=iYdOkYZdQ1KFULXSN0Gi7g~cust_params=~exp=1489680000~network_code=6062~pd=180000~pod_id=5~scte35=~hmac=86d7e5f8c96fe4c83141d764df376ae14a0e2066f2e6b2ccfb9e1e2d3c869a88
URL エンコードされた署名付きトークン:
custom_asset_key%3DiYdOkYZdQ1KFULXSN0Gi7g~cust_params%3D~exp%3D1489680000~network_code%3D6062~pd%3D180000~pod_id%3D5~scte35%3D~hmac%3D86d7e5f8c96fe4c83141d764df376ae14a0e2066f2e6b2ccfb9e1e2d3c869a88
例 2
次の例では、未入力のオプション変数が完全に省略されています。
トークン文字列
custom_asset_key=iYdOkYZdQ1KFULXSN0Gi7g3~exp=1489680000~network_code=6062~pd=180000~pod_id=5
秘密鍵
A7490591290583E4B93189DEE7E287C299FC686872ABC7ADC9F9F536443505F
HMAC 署名
6a8c44c72e4718ff63ad2284edf2a8b9e319600b430349d31195c99b505858c9
署名付きトークン
custom_asset_key=iYdOkYZdQ1KFULXSN0Gi7g~exp=1489680000~network_code=6062~pd=180000~pod_id=5~hmac=6a8c44c72e4718ff63ad2284edf2a8b9e319600b430349d31195c99b505858c9
URL エンコードされた署名付きトークン
custom_asset_key%3DiYdOkYZdQ1KFULXSN0Gi7g~exp%3D1489680000~network_code%3D6062~pd%3D180000~pod_id%3D5~hmac%3D6a8c44c72e4718ff63ad2284edf2a8b9e319600b430349d31195c99b505858c9
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-21 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-08-21 UTC。"],[[["\u003cp\u003eEach segment request using segment redirect pod serving requires an HMAC-signed token for authentication unless using early ad break notifications.\u003c/p\u003e\n"],["\u003cp\u003eThe token includes parameters like custom asset key, network code, pod ID, and duration, gathered from the ad break.\u003c/p\u003e\n"],["\u003cp\u003eAn HMAC signature is generated using a SHA-256 hash of the token string and a secret key from Google Ad Manager.\u003c/p\u003e\n"],["\u003cp\u003eThis signature is appended to the token string, which is then URL-encoded before being included in the segment request.\u003c/p\u003e\n"]]],[],null,["# Generate a signed HMAC token\n\nEach segment request made using segment redirect pod serving must include a\nHMAC-signed token for authentication, if not using\n[early ad break notifications](/ad-manager/video/Early.ad.break.notification).\n\nThis token can be calculated once per ad break and shared across all stream\nsessions.\n\nGather token parameters\n-----------------------\n\nGather the following information from the current ad break, to populate the\ntoken body.\n\n| Token Parameters |||\n|--------------------|------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `custom_asset_key` | Required | The custom livestream asset key, from Google Ad Manager. |\n| `cust_params` | Optional | Custom targeting parameters. See [cust_params](//support.google.com/admanager/answer/1080597). |\n| `exp` | Required | Expiration timestamp for this token in seconds. |\n| `network_code` | Required | The Ad Manager 360 network code for this network. |\n| `pod_id` | Required | Identifier for the ad break. Should be an integer starting at `1` and increasing by one for each ad break. **This value must be the same across all users viewing the same ad break in the current event.** |\n| `pd` | Required, except for events with durationless ad breaks enabled. | The duration in milliseconds of the ad break. Referred to above as `ad_pod_duration`. |\n| `scte35` | Optional | Base64-encoded SCTE-35 signal. It's the client's responsibility to ensure that the signal is correct. If incorrect, a message is sent to the `X-Ad-Manager-Dai-Warning` HTTP header in the response and the signal is still propagated to create an ad break. See the [supported ad markers](//support.google.com/admanager/answer/7245661#supported-ad-markers) for more information on how DAI uses the SCTE-35 signal. |\n\nCreate token string\n-------------------\n\nlist each parameter in alphabetical order, in the format `name=value`, with each\nname-value pair separated by a tilde (`~`) character.\n\nOptional parameters without a value can be left in-place with an empty string\nfor the value, or removed entirely.\n\n### token string format\n\n custom_asset_key={custom_asset_key}~exp={expiration}~network_code={network_code}~pd={pod_duration}~pod_id={ad_pod_index}~scte35={scte35_message}\n\nGenerate HMAC signature\n-----------------------\n\nThe HMAC signature is a SHA-256 hash of the token string in HEX format. The\nsecret key is the\n[HMAC authentication key](//support.google.com/admanager/answer/6381445)\nassociated with your livestream event in Google Ad Manager.\n\nSign token string\n-----------------\n\nOnce generated, append the HMAC signature to the token string in the following\nformat \n\n ~hmac={HMAC signature}\n\nURL-encode token string\n-----------------------\n\nThis token is passed as a URL parameter, so it must be URL-encoded for safety.\n\n### Example 1\n\nHere's an example where unused optional parameters are included as empty\nstrings.\n\n#### Token string\n\n custom_asset_key=iYdOkYZdQ1KFULXSN0Gi7g~cust_params=~exp=1489680000~network_code=6062~pd=180000~pod_id=5~scte35=\n\n#### Secret key\n\n A7490591290583E4B93189DEE7E287C299FC686872ABC7ADC9F9F536443505F\n\n#### HMAC signature\n\n 86d7e5f8c96fe4c83141d764df376ae14a0e2066f2e6b2ccfb9e1e2d3c869a88\n\n#### Signed token\n\n custom_asset_key=iYdOkYZdQ1KFULXSN0Gi7g~cust_params=~exp=1489680000~network_code=6062~pd=180000~pod_id=5~scte35=~hmac=86d7e5f8c96fe4c83141d764df376ae14a0e2066f2e6b2ccfb9e1e2d3c869a88\n\n#### URL-encoded signed token:\n\n custom_asset_key%3DiYdOkYZdQ1KFULXSN0Gi7g~cust_params%3D~exp%3D1489680000~network_code%3D6062~pd%3D180000~pod_id%3D5~scte35%3D~hmac%3D86d7e5f8c96fe4c83141d764df376ae14a0e2066f2e6b2ccfb9e1e2d3c869a88\n\n### Example 2\n\nHere's an example where the unpopulated optional variables are omitted entirely.\n\n#### Token string\n\n custom_asset_key=iYdOkYZdQ1KFULXSN0Gi7g3~exp=1489680000~network_code=6062~pd=180000~pod_id=5\n\n##### Secret key\n\n A7490591290583E4B93189DEE7E287C299FC686872ABC7ADC9F9F536443505F\n\n##### HMAC signature\n\n 6a8c44c72e4718ff63ad2284edf2a8b9e319600b430349d31195c99b505858c9\n\n#### Signed token\n\n custom_asset_key=iYdOkYZdQ1KFULXSN0Gi7g~exp=1489680000~network_code=6062~pd=180000~pod_id=5~hmac=6a8c44c72e4718ff63ad2284edf2a8b9e319600b430349d31195c99b505858c9\n\n#### URL-encoded signed token\n\n custom_asset_key%3DiYdOkYZdQ1KFULXSN0Gi7g~exp%3D1489680000~network_code%3D6062~pd%3D180000~pod_id%3D5~hmac%3D6a8c44c72e4718ff63ad2284edf2a8b9e319600b430349d31195c99b505858c9"]]