Table of Contents
setRESTtoken()
wrtc.setRESTtoken() is used to set REST authentication token.
REST authentication is carried out by user being authenticated by third part that gives user a token. Wrtc_kit will then send this token to IXNX server to prove it has been authenticated.
There are different methods to obtain the REST authentication token. One using HTTP GET is provided for your convenience wrtc.fetchRESTtoken(). You are however free to use whatever method you prefer to obtain the REST authentication token.
Once you have a fresh REST authentication token you must call wrtc.setRESTtoken() to give the token to the wrtc object.
Apart from storing the received REST authentication token, wrtc.setRESTtoken() also examines the unencrypted parts of the token and:
- sets wrtc.addressName if token contains a u= field
- sets wrtc.displayName if token contains a dname= field
- returns REST token path (URL to fetch next REST token from) if token contains a p= field
- starts a timer that will raise event wrtc.event.newRESTtoken after 75% of expiration time has passed if token contains an e= field
After wrtc.setRESTtoken() you need to call wrtc.changeCredentials() to send the new token to IXNX server.
Arguments
wrtc.setRESTtoken(token)
- token - the new REST authentication token
Returns
REST token path (URL to fetch next REST token from) if token contains a p= field, or undefined.