서버 측 광고 결합의 경우 매니페스트 조작기가 Google DAI에 광고 모음 세그먼트를 요청합니다. 자세한 내용은 광고 세그먼트 URL 빌드를 참고하세요.
이 페이지에서는 HMAC 토큰을 사용하여 광고 모음 세그먼트 요청을 인증하는 방법을 설명합니다.
시작하기 전에
계속하기 전에 다음을 수행하세요.
- 기본 요건을 완료합니다.
- Google Ad Manager 계정의 라이브 스트림 이벤트에서 팟 리소스 인증 키가 사용 설정되어 있는지 확인합니다.
HMAC 토큰 생성
토큰을 생성하려면 다음을 실행하세요.
- 포드 세그먼트 요청에 대해 채워진 경로 및 쿼리 매개변수 (인증 토큰 제외)를 수집합니다. 전체 목록은 메서드: 팟 세그먼트를 참고하세요.
매개변수를 단일 문자열로 정리합니다. 매개변수를 알파벳순으로 정렬하고 틸드
~문자로 구분해야 합니다. 예를 들면 다음과 같습니다.custom_asset_key=CUSTOM_ASSET_KEY~exp=EXPIRATION~network_code=NETWORK_CODE~pd=POD_DURATION~pod_id=POD_IDENTIFIERDAI 인증 키를 사용하여 토큰 문자열의 SHA-256 해시를 계산합니다.
해시 출력을 16진수로 형식 지정합니다.
토큰 문자열에 서명하려면 이전에 수집한 매개변수 끝에 서명을 추가합니다.
custom_asset_key=...~hmac=HMAC_SIGNATUREHMAC_SIGNATURE을 DAI 인증 키를 사용하여 토큰 문자열을 해싱하여 생성한 서명으로 바꿉니다.서명된 토큰 문자열을 안전하게 전달하려면 서명된 토큰 문자열에 URL 인코딩을 적용하세요.
다음 예시에서는 서명된 토큰 문자열의 URL로 인코딩된 값을 생성합니다.
HLS
# Add 60 seconds to the current time
future_epoch=$((EPOCHSECONDS + 60))
echo "Current: $EPOCHSECONDS"
echo "Future: $future_epoch"
# Current: 1774465950
# Future: 1774466010
# Sample DAI pod resource authentication key
key="EB08..."
# Sort parameters in the token string
token="ad_break_id=ab1~custom_asset_key=hls-pod-serving-redirect-auth-stream-pod~exp=1774466010~network_code=21775744923~pd=30000"
# Generate the token's signature.
echo -n $token | openssl dgst -sha256 -mac HMAC -macopt key:$key
# SHA2-256(stdin)= ff38abab31b436351e20ecd57bcc5b97acd9461abb71c4cf9c9731add965ecf2
# Sign the token: ad_break_id=ab1~custom_asset_key=hls-pod-serving-redirect-auth-stream-pod~exp=1774466010~network_code=21775744923~pd=30000~hmac=ff38abab31b436351e20ecd57bcc5b97acd9461abb71c4cf9c9731add965ecf2
# Encode the token: ad_break_id%3Dab1~custom_asset_key%3Dhls-pod-serving-redirect-auth-stream-pod~exp%3D1774466010~network_code%3D21775744923~pd%3D30000~hmac%3Dff38abab31b436351e20ecd57bcc5b97acd9461abb71c4cf9c9731add965ecf2
DASH
# Add 60 seconds to the current time
future_epoch=$((EPOCHSECONDS + 60))
echo "Current: $EPOCHSECONDS"
echo "Future: $future_epoch"
# Current: 1769540517
# Future: 1769540577
# Sample DAI pod resource authentication key
key="EB08..."
# Sort parameters in the token string
token="ad_break_id=ab1~custom_asset_key=dash-pod-serving-redirect-auth-stream-pod~exp=1774466641~network_code=21775744923~pd=30000"
# Generate the token's signature.
echo -n $token | openssl dgst -sha256 -mac HMAC -macopt key:$key
# SHA2-256(stdin)= 7249f9193778f2318314519ff2cea5c47958bc7fdd2eaf24008352867af0a050
# Sign the token: ad_break_id=ab1~custom_asset_key=dash-pod-serving-redirect-auth-stream-pod~exp=1774466641~network_code=21775744923~pd=30000~hmac=7249f9193778f2318314519ff2cea5c47958bc7fdd2eaf24008352867af0a050
# Encode the token: ad_break_id%3Dab1~custom_asset_key%3Ddash-pod-serving-redirect-auth-stream-pod~exp%3D1774466641~network_code%3D21775744923~pd%3D30000~hmac%3D7249f9193778f2318314519ff2cea5c47958bc7fdd2eaf24008352867af0a050
HLS 광고 모음 세그먼트 요청 인증
포드 리소스 요청을 인증하려면 auth-token 쿼리 문자열 매개변수를 사용하여 URL로 인코딩된 서명된 HMAC 토큰을 전달합니다.
HLS
다음 예에서는 HMAC 토큰을 사용하여 HLS 포드 세그먼트 요청을 인증합니다.
curl --include "https://dai.google.com/linear/pods/v1/seg/network/21775744923/custom_asset/hls-pod-serving-redirect-auth-stream-pod/ad_break_id/ab1/profile/media-ts-4628000bps/0.ts?stream_id=51b85d28-7ed5-48da-bfd8-e013b7d7b204:DLS&&sd=10000&pd=30000&auth-token=ad_break_id%3Dab1~custom_asset_key%3Dhls-pod-serving-redirect-auth-stream-pod~exp%3D1774466010~network_code%3D21775744923~pd%3D30000~hmac%3Dff38abab31b436351e20ecd57bcc5b97acd9461abb71c4cf9c9731add965ecf2"
성공하면 다음과 같은 응답이 표시됩니다.
...
< HTTP/2 302
< access-control-allow-headers: Authorization
< access-control-allow-origin: *
< access-control-expose-headers: Location
< cache-control: no-cache, no-store, max-age=0, must-revalidate
< date: Wed, 25 Mar 2026 18:13:40 GMT
< expires: Mon, 01 Jan 1990 00:00:00 GMT
< location: https://redirector.googlevideo.com/....
< pragma: no-cache
< x-content-type-options: nosniff
< x-frame-options: SAMEORIGIN
...
응답 구조와 상태 코드를 이해하려면 메서드: 팟 세그먼트를 참고하세요.
인증에 실패하면 x-ad-manager-dai-warning가 표시됩니다.
...
< HTTP/2 302
< access-control-allow-headers: Authorization
< access-control-allow-origin: *
< access-control-expose-headers: Location
< cache-control: no-cache, no-store, max-age=0, must-revalidate
< date: Wed, 25 Mar 2026 18:17:21 GMT
< expires: Mon, 01 Jan 1990 00:00:00 GMT
< location: https://redirector.googlevideo.com/....
< pragma: no-cache
< x-ad-manager-dai-warning: Unable to create ad break due to Unauthorized error (skipping ad break creation)
< x-content-type-options: nosniff
...
DASH
다음 예에서는 HMAC 토큰을 사용하여 DASH 포드 세그먼트 요청을 인증합니다.
curl --include "https://dai.google.com/linear/pods/v1/seg/network/21775744923/custom_asset/dash-pod-serving-redirect-auth-stream-pod/ad_break_id/ab1/profile/media-ts-4628000bps/0.ts?stream_id=8b061ab5-1efc-4e4d-882f-ae3c071df854:ATL&&sd=10000&pd=30000&auth-token=ad_break_id%3Dab1~custom_asset_key%3Ddash-pod-serving-redirect-auth-stream-pod~exp%3D1774466641~network_code%3D21775744923~pd%3D30000~hmac%3D7249f9193778f2318314519ff2cea5c47958bc7fdd2eaf24008352867af0a050"
성공하면 다음과 같은 응답이 표시됩니다.
...
HTTP/2 302
..
location: https://redirector.googlevideo.com/....
...
응답 구조와 상태 코드를 이해하려면 메서드: 팟 세그먼트를 참고하세요.
인증이 실패하면 다음과 같이 x-ad-manager-dai-warning이 표시됩니다.
...
HTTP/2 302
..
location: https://redirector.googlevideo.com/....
pragma: no-cache
x-ad-manager-dai-warning: Unable to create ad break due to Unauthorized error (skipping ad break creation)
x-content-type-options: nosniff
...