> ## Documentation Index
> Fetch the complete documentation index at: https://bunnynet-cb9733c2-support-migration.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Embedded view token authentication

> Secure your video embeds with token authentication to prevent unauthorized playback.

The Embed View Token Authentication allows you to secure your iframe to prevent unauthorized embedding of your videos.

<Note>
  Once enabled, every embed request to the iframe must include a valid `token` and `expires` pair. A **403 Forbidden** on the iframe almost always means one of: the `expires` timestamp has already passed, the token was hashed with the wrong key/video ID/expiration combination, or the parameters are missing entirely. Generate tokens server-side — never expose your token security key in client-side code.
</Note>

## Signing procedure

To create a secure URL, you must add a **token** and **expires** query parameters to the URL that you want to access. The expires parameter is the UNIX timestamp in seconds marking until when the URL is accessible. Milliseconds and nanoseconds are not supported. After this passes, the URL will no longer be accessible.

The token parameter is a HEX value of the SHA256 hash based on the key, video ID and expiration time. To generate the token, you can use the following algorithm.

<CodeGroup>
  ```bash SHA256_HEX theme={null}
  SHA256_HEX(token_security_key + video_id + expiration)
  ```

  ```bash SHA256 theme={null}
  SHA256("4742a81b-bf15-42fe-8b1c-8fcb9024c550" + "32d140e2-e4f4-4eec-9d53-20371e9be607" + 1623440202)
  ```
</CodeGroup>

An example secure URL will then look like:

```bash theme={null}
https://iframe.mediadelivery.net/embed/759/eb1c4f77-0cda-46be-b47d-1118ad7c2ffe?token=5a5de480db5d14ed30717a3e849c7148a998fa42b0c267774756558e2de99eee&expires=1456761770
```

Similarly, the MediaCage Enterprise DRM license service endpoint URL example looks like:

```bash theme={null}
https://video.bunnycdn.com/FairPlayLicense/759/eb1c4f77-0cda-46be-b47d-1118ad7c2ffe?token=5a5de480db5d14ed30717a3e849c7148a998fa42b0c267774756558e2de99eee&expires=1456761770
```
