OpenTV ENTera & OpenTV Platform Documentation
26.26_Q2 25.52_Q4 25.26_Q2 25.12_Q1 24.50_Q4 24.38_Q3 24.26_Q2 23.50_Q4 23.24_Q2 23.12_Q1 22.50_Q4 22.38_Q3 22.24_Q2
26.26_Q2 25.52_Q4 25.26_Q2 25.12_Q1 24.50_Q4 24.38_Q3 24.26_Q2 23.50_Q4 23.24_Q2 23.12_Q1 22.50_Q4 22.38_Q3 22.24_Q2

Managing client application version checks

Overview

OpenTV Platform can check which version of the client application a device is running when it signs in or refreshes its access token. You can use this to make users upgrade old versions of your application.

For each device profile, you can set two versions:

  • clientWarningVersion – devices running this version or a lower one can still sign in, but OpenTV Platform tells the client application that it should be upgraded.

  • clientErrorVersion – devices running this version or a lower one can’t sign in or refresh their tokens until the application has been upgraded.

The client application sends its version in the client-application-version header – see Handling client application version checks in the Client integration guide.

How the check works

When a client signs in or refreshes its tokens, OpenTV Platform does the following:

  1. If the request has a client-application-version header, it checks the header’s format. The version must be in the form major.minor.patch – three whole numbers separated by full stops, for example 4.2.0. A request with any other value is refused with an HTTP 400 status ("errorCode": 6011), even if the version check is switched off.

  2. If the request has no client-application-version header and Block If Version Missing is switched on, the request is refused with an HTTP 400 status ("errorCode": 6010).

  3. If Check Client Version is switched on, it compares the version with the versions set on the device’s profile. If the version is the same as clientErrorVersion or lower, the request is refused with an HTTP 403 status ("code": 20017). Otherwise, if the version is the same as clientWarningVersion or lower, the client gets its tokens as usual, and the response also has a client-application-version-warning header.

Versions are compared number by number, so 1.10.0 is higher than 1.9.0. Leading zeros are ignored, so 2.05.00 is the same as 2.5.0.

Both checks include the version that you set – a device running exactly the clientErrorVersion is refused. So set clientErrorVersion to the highest version that you want to block, not the first version that you want to allow. For example, to block every version lower than 3.0.0, set it to the highest 2.x version that you released.

The device’s profile is the profile assigned to the device. When a device signs in for the first time, OpenTV Platform uses the profile that the device classifiers assign to it from its device information (see Creating and managing device classifiers in the OpCon documentation).

If the device’s profile has no clientErrorVersion, devices with that profile are never refused. If it has no clientWarningVersion, they never get a warning. If a profile has neither, its devices aren’t checked at all.

The check runs on every sign-in call and on the token refresh call – for the full list, see Handling client application version checks. It doesn’t run on calls that return a token without extending how long the client stays signed in, such as switching user profile or getting a content token.

Tokens that were issued before you changed the versions aren’t withdrawn. They stay valid until they expire, and the check runs the next time the client refreshes them.

Switching the check on and off

Two settings switch the check on and off for the whole platform. Both are off by default. They are set in OpCon (System Configuration > Device Management > Global Setting tab – see Device Management in the OpCon documentation). There is no API for them.

  • Check Client Version – compares the client’s version with the versions set on the device’s profile, and refuses or warns devices with an old version.

  • Block If Version Missing – refuses sign-in and refresh requests that have no client-application-version header. This setting works on its own – it also applies when Check Client Version is off.

When you switch on Check Client Version, OpCon reminds you that the check is skipped for device profiles with no versions set.

Whatever these settings are, a valid client-application-version header also updates the application version stored for the device (deviceInformation.application.version), except on the device’s first sign-in. See Update device information in the Client integration guide.

Rolling out a version check

To roll out a version check without locking users out:

  • Before you switch anything on, make sure that every version of your client application that is in use sends the client-application-version header in the major.minor.patch format. A client that sends it in another format can’t sign in, even with both settings off.

  • Set clientWarningVersion to a higher version than clientErrorVersion. Devices at or below the error version are refused, and devices between the two versions are warned. If the warning version is the same as the error version or lower, no device ever gets a warning, because the error check comes first.

  • You can set both versions at the same time. But devices at or below the error version are refused straight away, so consider setting the warning version first, to give users of old versions time to upgrade while they can still use the application.

  • Set the versions on every device profile that your devices use, including the DEFAULT profile.

  • Only switch on Block If Version Missing when no clients without the header are left. A client without the header gets an HTTP 400 status, not the 403 status ("code": 20017) that tells it to ask the user to upgrade.

Supported actions

See also