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

Validating an identity token

Overview

When the web application receives an identity token, its back end must check that the token is genuine and still valid before it trusts the account and device IDs in it. It does this itself, with the public key and a standard JWT library – it doesn’t call OpenTV Platform.

Prerequisites

Get the public keys – see Getting the identity token public keys. You can keep them, and get them again when you need to (see step 2 below).

Validating the token

  1. Decode the token’s header and check that alg is RS256. Reject the token if it has any other algorithm.

  2. Find the public key whose kid matches the token’s kid. If there is none, get the public keys again, because the keys may have been changed. If there is still no match, reject the token.

  3. Check the token’s signature with that key.

  4. Check that exp is in the future.

  5. Check that iss is IAS.

  6. If the web application serves more than one tenant, check that tenantId is the tenant you expect.

  7. Read accountId and deviceId, and sign the user in.

For the claims that a token contains, see Enabling single sign-on to a self-care portal. There is no aud (audience) claim to check.

Handling expired tokens

If the token has expired, don’t sign the user in. Instead, ask the client application for a new token. For example, OpenTV ION reloads the web application with a new token when the web application tells it that the token has expired – see the Self-care portal integration guide in the OpenTV ION documentation.

See also