# Authenticate ad pod requests

Google Dynamic Ad Insertion (DAI) starts the ad decision process for
an ad break when the following occur:

- You use the Ad break API to create the ad break entity for upcoming ad breaks.
- You authenticate your ad pod requests by including an HMAC token.

We recommend using the [Ad Break API](https://developers.google.com/ad-manager/dynamic-ad-insertion/api/pod-serving/reference/live#method_ad_break_api).
If the Ad break API fails or not used, you must authenticate your ad pod requests with Hash-Based Message Authentication Code (HMAC) tokens.

## Before you begin

Before you continue, make sure you have the following from the [Google Ad Manager UI](https://admanager.google.com):

- A DAI authentication key with the type **HMAC**. If you don't have a key, do the following:

  1. Go to **Admin \> Video and audio**.
  2. Select **DAI authentication keys**.
  3. Click **New DAI authentication key**.
  4. From the drop-down, select type **HMAC**.
  5. Enter a name and select **Save**.
- A livestream configured for DAI.

## Enable authentication for ad pod requests

To support authenticated requests, enable **pod resource keys** in
your livestream event and linking DAI authentication key to your livestream.
You use the linked DAI authentication key to generate an HMAC token for authenticating your ad pod requests.
To link your HMAC key to your livestream, do the following:

1. In the **[Google Ad Manager UI](https://admanager.google.com)** , navigate to **Video \> Live streams**.
2. Select your livestream from the list.
3. Enable **Pod resource authentication keys**.
4. Select and add the **HMAC Key** you identified in the [prerequisites]().
5. Save your changes.

For more information, see [Set up a livestream for DAI](https://support.google.com/admanager/answer/7294289).

For your specific request type, complete the following:

- [Authenticate ad pod timing metadata (ATM) requests](https://developers.google.com/ad-manager/dynamic-ad-insertion/api/pod-serving/live/atm-request)
- [Authenticate ad pod requests for pod segments](https://developers.google.com/ad-manager/dynamic-ad-insertion/api/pod-serving/live/pod-segment-requests)
- [Authenticate ad pod requests for pod manifest](https://developers.google.com/ad-manager/dynamic-ad-insertion/api/pod-serving/live/pod-manifest-requests)

To generate HMAC tokens for testing, use the [HMAC Token
Generator](https://developers.google.com/ad-manager/dynamic-ad-insertion/api/pod-serving/live/token#token_generator).