Tokens in URLs (content, screensaver, and token service URLs all support tokens) are only replaced if a matching token is found, otherwise the braces and token name are left intact. The token service is expected to return a JSON object. Any values in this object will be available as tokens using lodash get syntax. For example, if your token service returns
{
location: {
type: 'produce'
},
fruit: [{
id: 1,
type: 'apple'
},{
id: 2,
type: 'orange'
}]
}
you could use tokens such as {fruit[0].id} or {location.type}. Internally, the request to fetch the json from the token service uses jQuery.getJSON so you should either enable CORS or ideally support JSONP and include the callback=? parameter in your token service URL. The token service URL can only support system or custom tokens. The “custom tokens” field works similarly to the token service. You can specify a json object and any contents will be available as tokens. Generally this is used to set tokens on device groups via Chrome Device Management Console. The order of precedence for tokens (if they have the same key names) is:
-
custom tokens
-
token service
-
system tokens.
Comments
0 comments
Please sign in to leave a comment.