Do not host authentication tokens in any publicly-accessible locations (such as public source code repositories).
Doing so presents a security risk.
When a client application connects to OpenTV Platform to gain service, access is gated via an initial authentication of identity which yields an identity access token and a refresh token.
-
The access token is limited to a short time (by default, 24 hours, but this can vary by deployment).
-
The refresh token has a longer duration, for example, up to 48 hours.
When a client discovers that its access token has expired, it submits the refresh token. The account and device status are verified as still valid, and if so, both the access token and the refresh token are re-issued and sent in response to the client. The client then updates its token store and uses the access token as usual. When the new access token expires, the cycle is repeated. If the refresh token is found to have expired, the client will be directed back to credentials sign-on as all information is too old to trust.
Request
To get a new access token and refresh token, send a POST request to:
https://<host>:<port>/ias/v3/token/actions/refresh
Headers
-
Authorization– the client's refresh token, as a bearer token (Bearer <refresh token>). This is therefresh_tokenthat the client got when it signed in, or from its last refresh – see Authentication token. This header is mandatory. -
Content-Type: application/json– send this header even though the request has no body. Without it, the request returns an HTTP 415 status. -
client-application-version– the version of the client application, in the formmajor.minor.patch(for example4.2.0). The operator can use it to warn or refuse old versions of the application – see Handling client application version checks.
Don't send an Authorization-Decoded header, even though the IAS API reference lists one. OpenTV Platform checks the refresh token in the Authorization header and passes its decoded contents to IAS itself.
Mandatory arguments
None. The request has no body.
Response
A successful request returns an HTTP 200 status. The response body contains the new access token and refresh token, for example:
{
"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"
}
}
}
-
expires_in– the lifetime of the new access token, in seconds -
refresh_expires_in– the lifetime of the new refresh token, in seconds -
fixed_refresh_expires_in– the time, in seconds, until the refresh token's fixed expiry. Refreshing doesn't extend it: once it has passed, the client must sign in again. -
access_token,refresh_token– the new tokens, as signed JWTs. For the claims they contain, see theAccessTokenandRefreshTokenschemas in the Identity Authentication Service (IAS) API documentation.
If the client application is out of date, the response also has a client-application-version-warning header – see Handling client application version checks.
A bad request returns an HTTP 400 status – for example, if the client-application-version header isn’t in the major.minor.patch format ("errorCode": 6011), or if the platform requires the header and the request doesn’t send it ("errorCode": 6010).
A forbidden request returns an HTTP 403 status – for example, if the refresh token is missing, invalid, or has expired, or if the account is suspended or cancelled or the device is no longer allowed. If the refresh token has expired, the client must sign in again.
If the client application is too old to refresh its tokens, the request returns an HTTP 403 status with "code": 20017. The user must upgrade the application – see Handling client application version checks.
See also
For full details of this API, see Identity Authentication Service (IAS) API documentation.