Learn how to protect private video content in the FastPix iOS Player using token-based authentication.
To control access to private media content, the FastPix iOS Player supports token-based authentication for both on-demand and live streams. Tokens ensure that only authorized users can view protected content.
Security best practices
When securing private media streams, follow these practices:
- Access private media using dynamically generated, short-lived playback IDs tied to the user’s authenticated session.
- Authenticate users (for example, using OAuth or JWT) before granting access to private media.
- Always use HTTPS for API calls and media streams to prevent interception.
- Generate signed tokens for playback IDs that are valid only for a limited time and associated with a specific user session.
How access tokens work
Access tokens are short-lived credentials that authenticate a user’s right to view content. When a user requests a stream, the player sends the token to verify authorization.
The token workflow:
- Generate the token server-side after the user authenticates. The token includes a signature and expiration date (for example, 1 hour). See how to generate access tokens for details.
- Pass the token to the player along with the playback ID when configuring playback.
For a detailed guide on JWT token generation, see Secure playback with JWTs.
Secure on-demand playback
Pass the playbackToken in PlaybackOptions to secure an on-demand stream:
Secure live stream playback
For live streams, include both the streamType and playbackToken:
What’s next
- Play DRM-protected content for FairPlay DRM encryption.
- Handle playback errors for troubleshooting token issues.