Dynamic ad insertion (DAI) authentication keys are used to prove that video stream requests are coming from you. They provide better security during ad serving. A key is an unbroken string of 64 characters and numbers. Some older keys may be 25 characters or numbers.
Example
0L94DEA6C87B0F3D2407018ACF88ECDE77DK38AD1DX01957311A50E9D1O3F15B
Static API keys: API keys take precedence over HMAC when both are included. API keys are less secure than HMAC keys. Use of HMAC keys is therefore recommended.
HMAC: HMAC-based token authentication provides more security than static API keys. HMAC tokens use a secret key and limited duration to ensure the token cannot be easily shared across users or sessions.
Tip: Before authenticating stream requests, ensure you have the following:
- DAI authentication key with the type HMAC
- Livestream configured for DAI
Add a new HMAC DAI authentication key
Generate and add a new HMAC type DAI authentication key:
- Sign in to Google Ad Manager.
- Click Admin, then Video and audio.
- Select “DAI authentication keys”.
- Click New DAI authentication key.
- Enter the name of the new key. Select the Type "HMAC."
- Click Save.
This key is linked in your livestream when you enable authentication.
Enable authentication for requests to DAI APIs
Link your HMAC key to your stream:
- Sign in to Google Ad Manager.
- Click Video, then Live streams.
- Select your livestream from the list, or click New livestream. Learn more about creating a new livestream.
- Under General settings,
- Select “Enabled” for “Pod resource authentication keys” for authenticating ad pod requests and/or
- Select "Enabled" for "Stream to create authentication keys" for authenticating stream session requests
- Select the HMAC key you created.
- Click Save.
To view and copy your key, return to the details page. Once you create an active DAI authentication key, you can use it immediately. Embed the key on the client video app, where you make DAI stream requests.
Keys are automatically set to "Active" upon save. Only correctly implemented "Active" keyscan validate requests.
Requests using deactivated keys are denied. Only deactivate a key if it becomes compromised or should not be used.
Deactivate an existing authentication key
With the following steps you can deactivate an authentication key:
- Sign in to Google Ad Manager.
- Click Admin, Video and audio, then "DAI authentication keys."
- From the list, select the key you want to deactivate.
- Select the Status "Inactive."
- Click Save.
Implement an authentication key
HMAC keys
Learn how to implement HMAC authentication.
API keys
Use the IMA SDK to set the apiKey property on the IMAStreamRequest object. See the iOS, Android, Chromecast, or tvOS developer documentation for more information.
For server-side beaconing (SSB), use the api-key query parameter:
curl "https://dai.google.com/ondemand/hls/content/CMS_ID/vid/VIDEO_ID/master.m3u8?api-key=<api-authentication-key>"