KWS Utils

The Kids Web Service SDK has an utility class to help you out with some operations.

Parsing JWT Tokens

As highilighted before, the SDK works with JWT Tokens when dealing with sessions.

A simple way of retrieving information from the authenticated token is by using the out-of-the-box UtilsHelper class.

//we'll assume 'token' is valid
let token = "AAA.BBB.CCC"

//parse the token
let tokenData = UtilsHelper.getMetadataFromToken(token: token)

if tokenData != nil {
 //Cool! We have a valid token data object. We can start using its data.
} else {
 //Uh-oh! It seems there's an error...

This is a sync operation that returns:

Type Meaning
TokenData If non-null, a valid object

The TokenData object, as seen before, contains the following fields:

Field Type Meaning
userId Integer The user id for the parsed token
appId Integer The app id for the parsed token
clientId String The client id for the parsed token
scope String The scope for the parsed token
iss String The issue entity for the parsed token
iat Long The issued time as timestamp
exp Long The expiry time as timestamp


This is only a suggestion on how to parse the authenticated token.