onNeedRESTtoken()

wrtc.onNeedRESTtoken() is called when REST authentication token is about to expire and system should fetch a new token.

You can use this event to fetch a new REST authentication token.

Occurs

About 75% of REST authentication token's expiration time has passed. A new token should be fetched before old one expires.

Argument

wrtc.onNeedRESTtoken(token)

  • token - string containing current REST authentication token

Example

You can use any method to fetch a new REST authentication token; function wrtc.fetchRESTtoken() provided for you is using HTTP GET.

The below example code fetches new REST authentication token from web URL stored as value p= in old token:

wrtc.onNeedRESTtoken(token) {
    var path = token.match(/\np=(.*)/);
    if ((path) && (path.length == 2))
      wrtc.fetchRESTtoken(path[1], function(newtoken){wrtc.setRESTtoken(newtoken); wrtc.changeCredentials()});
}

See Also

ixnx/wrtc/js/api/wrtc/onneedresttoken.txt · Last modified: by tibor
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0