REST API V2 Checklist rest-api-v2-checklist
- Topics:
- Authentication
This document aggregates in one place the mandatory requirements and recommended practices for Programmers implementing client applications that consume ÃÛ¶¹ÊÓƵ Pass Authentication REST API V2.
Following this document must be considered part of your acceptance criteria when implementing the REST API V2 and must be used as a checklist to ensure that all necessary steps have been taken to obtain a successful integration.
Mandatory Requirements mandatory-requirements
1. Registration Phase mandatory-requirements-registration-phase
2. Configuration Phase mandatory-requirements-configuration-phase
Retrieve the configuration response only when requiring to prompt the user to select their MVPD (TV provider) prior to the Authentication Phase.
There is no need to retrieve the configuration response when:
- The user is already authenticated.
- The user is offered temporary access.
- The user authentication has expired, but the user can be prompted to confirm they are still a subscriber of the previously selected MVPD.
Store the user's Pay TV provider (MVPD) selection in persistent storage to use it in all subsequent phases:
- From configuration response store the user selected MVPD "id".
- From configuration response store the user selected MVPD "displayName".
- From configuration response store the user selected MVPD "logoUrl".
3. Authentication Phase mandatory-requirements-authentication-phase
Start the polling mechanism under the following conditions:
Authentication performed within the primary (screen) application
- The primary (streaming) application should start polling when the user reaches the final destination page, after the browser component loads the URL specified for the "redirectUrl" parameter in the Sessions endpoint request.
Authentication performed within a secondary (screen) application
- The primary (streaming) application should start polling as soon as the user initiates the authentication process—right after receiving the Sessions endpoint response and displaying the authentication code to the user.
Stop the polling mechanism under the following conditions:
Successful authentication
- The user's profile information is successfully retrieved, confirming their authentication status, therefore polling is no longer needed.
Authentication session and code expiry
- The authentication session and code expire, the user must restart the authentication process, and polling using the previous authentication code should be stopped immediately.
New authentication code generated
- If the user requests a new authentication code, then the existing session is invalidated, and polling using the previous authentication code should be stopped immediately.
Configure the polling mechanism frequency under the following conditions:
Authentication performed within the primary (screen) application
- The primary (streaming) application should poll every 3-5 seconds.
Authentication performed within a secondary (screen) application
- The primary (streaming) application should poll every 3-5 seconds.
Store parts of the user's profile information in persistent storage to improve performance and minimize unnecessary REST API v2 calls.
Caching should focus on the following profiles response fields:
mvpd
- The client application can use this to keep track of the user's selected TV provider and continue to use it further during Preauthorization or Authorization Phases.
- When the current user profile expires, the client application can use the remembered MVPD selection and just ask the user to confirm.
attributes
- Used to personalize the user experience based on different user metadata keys (e.g., zip, maxRating, etc.).
- User metadata becomes available after the authentication flow completes, therefore the client application does not need to query a separate endpoint to retrieve the user metadata information, as it is already included in the profile information.
- Certain metadata attributes may be updated during the Authorization Phase, depending on the MVPD (e.g., Charter) and the specific metadata attribute (e.g., householdID). As a result, the client application may need to query the Profiles APIs again after authorization to retrieve the latest user metadata.
4. (Optional) Preauthorization Phase mandatory-requirements-preauthorization-phase
Risks bypassing our monitoring and alerting systems.
Only a limited number of enhanced error codes warrant a retry, while most require alternative resolutions as specified in the action field.
Ensure that any retry mechanism implemented for retrieving preauthorization decisions does not result in an endless loop and that it limits retries to a reasonable number (i.e., 2-3).
5. Authorization Phase mandatory-requirements-authorization-phase
Allow streams to continue uninterrupted even if the media token expires during playback and request a new authorization decision containing a (fresh) media token when the user makes their next playback request, regardless it is for the same or a different resource.
Live streams running for extended periods of time may choose to request a new authorization decision following video operations such as pausing content, initiating commercial breaks, or modifying asset-level configurations when the MRSS undergoes changes.
Risks bypassing our monitoring and alerting systems.
Only a limited number of enhanced error codes warrant a retry, while most require alternative resolutions as specified in the action field.
Ensure that any retry mechanism implemented for retrieving authorization decisions does not result in an endless loop and that it limits retries to a reasonable number (i.e., 2-3).
6. Logout Phase mandatory-requirements-logout-phase
Implement the logout API to allow users to manually sign out, terminating their authenticated profile and follow the REST API v2 action name specified for each removed profile:
- For MVPDs supporting a logout endpoint the client application requires to navigate to the provided "url" in a user-agent.
- For "appleSSO" type profiles, the client application requires to guide the user to also log out from the partner level (Apple’s system settings).
7. Parameters and Headers mandatory-requirements-parameters-headers
Even when the request originates from a server on behalf of a device, the AP-Device-Identifier header value must reflect the actual streaming device identifier.
Even when the request originates from a server on behalf of a device, the X-Device-Info header value must reflect the actual streaming device information.
Additionally, some fields, such as the streaming device connectionIp and connectionPort, are mandatory for features like Spectrum’s Home Base Authentication.
For platforms without a hardware identifier, generate a unique identifier from application attributes and persist it.
8. Error Handling mandatory-requirements-error-handling
Only a limited number of enhanced error codes warrant a retry, while most require alternative resolutions as specified in the action field.
Most enhanced error codes listed in the Enhanced Error Codes - REST API V2 documentation can be prevented entirely if correctly handled during development phase before launching the application.
Risks client application malfunction due to missing handling of the enhanced error codes — causing unclear error messages, improper user guidance, or incorrect fallback behavior.
Only a limited number of HTTP error codes warrant a retry, while most require alternative resolutions.
Most HTTP error responses can be prevented entirely if correctly handled during development phase before launching the application.
Risks client application malfunction due to missing handling of the enhanced error codes — causing unclear error messages, improper user guidance, or incorrect fallback behavior.
9. Testing mandatory-requirements-testing
Develop and test the application using the official ÃÛ¶¹ÊÓƵ Pass Authentication non-production environments:
- Prequal-Production
- Release-Staging
Perform thorough quality assurance (QA) in these environments before launching to Release-Production.
Client applications must not proceed to Release-Production without first completing end-to-end validation in non-production environments.
Lacking a short and efficient debugging path can hinder ÃÛ¶¹ÊÓƵ Support and Engineering from intervening quickly.
Recommended Practices recommended-practices
1. Registration Phase recommended-practices-registration-phase
Ensure that any retry mechanism for handling HTTP 401 "Unauthorized" errors first refreshes the access token before retrying the original request.
2. Configuration Phase recommended-practices-configuration-phase
3. Authentication Phase recommended-practices-authentication-phase
Validate authentication code submitted through user input on the secondary (2nd) application (screen) before calling /api/v2/authenticate API under the following conditions:
Authentication performed within secondary (screen) application with preselected mvpd
- Make use of Resume authentication session - POST /api/v2/{serviceProvider}/sessions/{code}
Authentication performed within secondary (screen) application without preselected mvpd
- Make use of Retrieve authentication session - GET /api/v2/{serviceProvider}/sessions/{code}
The client application would receive an error if the provided authentication code was typed wrong or in case the authentication session would be expired.
Support non-basic flows in case the client application business requires:
- Degraded access flows (premium feature)
- Temporary access flows (premium feature)
- Single sign-on access flows (standard feature)
4. (Optional) Preauthorization Phase recommended-practices-preauthorization-phase
5. Authorization Phase recommended-practices-authorization-phase
6. Logout Phase recommended-practices-logout-phase
7. Parameters and Headers recommended-practices-parameters-headers
Reuse code from REST API v1 for calling the DCR API to retrieve an access token.
8. Testing recommended-practices-testing
Ensure the following basic flows are tested across devices and platforms:
Authentication flows
- Primary application (screen) authentication scenario
- Secondary application (screen) authentication scenario
(Optional) Preauthorization flows
- Test permit decisions scenario
- Test deny decisions scenario
Authorization flows
- Test permit decisions scenario
- Test deny decisions scenario
Logout flows
Additionally, test other access flows, if applicable:
- Degraded access flows (premium feature)
- Temporary access flows (premium feature)
- Single sign-on access flows (standard feature)
Cover top MVPD integrations (covering the most widely used providers).
Summary summary
Cache access tokens
Cache parts of profiles
Support Degradation Feature (if business requirement)
Support TempPass Feature (if business requirement)
Support Single Sign-On Feature (if business requirement)
Retry mechanism fine tuning
Retry mechanism fine tuning
Media token validation
Implement HTTP error handling