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

Switching to a different user profile

Request

To switch to a different user profile, send a POST request to:

Bash
https://<host>:<port>/ias/v4/token/actions/changeUserProfile

This returns an access token containing the details of the user profile that was switched to.

The platform checks the parental PIN when the user switches from a child profile to a non-child profile. To do this, it compares the current profile in the access token with the target profile. So send the access token that was issued for the profile that is currently in use (for example, the one returned by the previous profile switch), not an older one. Depending on the deployment's configuration, the platform may instead check the PIN on every switch, or not at all. See Server-side PIN checks in PIN and parental control management.

By default, after switching to a profile, that profile remains in use unless the client explicitly calls this endpoint to switch to a different one. If you need different behaviour (for example, to apply a time limit to the use of a non-child profile, to prevent a child from using it because it happens to be the last one used), you are responsible for implementing this behaviour in your client application.

The earlier version of this request, POST /ias/v3/token/actions/changeUserProfile, is deprecated. It doesn't check the PIN, so with v3 the client application must prompt for the parental PIN and verify it (see Verifying user-supplied PINs) before switching from a child profile to an adult profile. The v3 request takes the same arguments apart from pin.

Headers

  • Authorization – the client's access token, as a bearer token (Bearer <access token>). This is the access_token that the client gets when it signs in – see Authentication token. This header is mandatory.

  • Content-Type: application/json

  • x-correlation-id – identifier for logging, to correlate messages across a call flow

Don't send an Authorization-Decoded header, even though the IAS API reference lists one. OpenTV Platform checks the access token in the Authorization header and passes its decoded contents to IAS itself.

Mandatory arguments

The following argument is in the request body:

  • newUserProfileId – the ID of the profile to switch to

Other arguments

The following argument is in the request body:

  • pin – the PIN that the user entered. Required when the platform checks the PIN (by default, when switching from a child profile to a non-child profile). Otherwise it is ignored.

Example

A request with this payload switches to the specified profile, supplying the parental PIN:

JSON
{
  "newUserProfileId": "507f191e810c19729de860ea",
  "pin": "1234"
}

Response

A successful request returns an HTTP 200 status. The response body contains a new access token and refresh token for the profile that was switched to, for example:

JSON
{
  "access_token": "eyJraWQiOiIyNTk2MjkiLCJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXAiOiJEZXZBdXRoTiIs...",
  "refresh_token": "eyJraWQiOiIyNTk2MjkiLCJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXAiOiJSZWZyZXNoQXV0aE4iLC...",
  "client_id": "device7",
  "accountId": "account7",
  "token_type": "bearer",
  "expires_in": 86400,
  "refresh_expires_in": 172800,
  "fixed_refresh_expires_in": 2419200,
  "parentalControl": {
    "ratingThreshold": {
      "FSK": "fsk12"
    }
  },
  "currentUserProfileId": "507f191e810c19729de860ea"
}
  • access_token, refresh_token – the new tokens, as signed JWTs. The access token contains the profile that was switched to (currentUserProfile). From now on, use these tokens instead of the old ones. For the claims they contain, see the AccessToken and RefreshToken schemas in the Identity Authentication Service (IAS) API documentation.

  • currentUserProfileId – the ID of the profile that was switched to

  • parentalControl – the account's parental control settings, such as its rating thresholds. It is only included if the account has parental control settings.

  • expires_in, refresh_expires_in, fixed_refresh_expires_in – the token lifetimes, in seconds, as in the response to a token refresh (see Refresh token)

A bad request returns an HTTP 400 status – for example:

  • "errorCode": 4726 – a PIN is required but the request has no pin.

  • "errorCode": 4709 – newUserProfileId is missing.

  • "errorCode": 4705 – the profile does not exist.

  • "errorCode": 4725 – the access token contains no current profile.

An unauthorised request returns an HTTP 401 status ("errorCode": 1001) if the account has no PIN of the type that is checked.

A forbidden request returns an HTTP 403 status – for example:

  • "errorCode": 4566 – the PIN is wrong.

  • "errorCode": 7123 – the PIN is wrong and the user has a limited number of attempts left, or the PIN is locked after too many wrong attempts.

  • "errorCode": 4700 – the profile belongs to another account.

  • The access token is missing, invalid, or has expired.

If user profiles are not enabled in the deployment, the request returns an HTTP 503 status ("errorCode": 4701).

See also

For full details of this API, see the Identity Authentication Service (IAS) API documentation.