There are two ways to authenticate your key that are described below.

  1. Using CORS authentication (default)
  2. Using Credential authentication 


Using CORS authentication

Room session timeout: 24 hours


This allows your web application to authenticate based on the CORS domain it is accessing from.


To set it up:


1. Enter the domain which your web application will access from in the CORS url field of your Application Key created. (your platform field will need to be Web/Mobile Web)



2. In the init() method, you will just need to provide your Application Key

  

skylink.init({
  appKey: "<% APP_KEY %>"
});

  


3. Access your web application based on the domain name for authentication. The user should be able to connect to the room, after this.





Note that the general room session timeout for each user who connects is 24 hours.



Using credentials authentication

Room session timeout: (user set)


This lets your web application authenticate based on user generated credentials provided, and also lets you set a room session timeout.


To set it up:


1. Copy the secret in the Application Key



2. Generate the credentials (which you can refer here in the init() method credentials.credentials field)


If Persistent Room feature is enabled, the server will check if there is any existing meetings that is created with the same credentials.startDateTime stamp and credentials.duration based on the appKey provided in the init() method. If there are no meeting records, the error state API_NO_MEETING_RECORD_FOUND would be triggered in the readyStateChange eventElse, the server will start the connection. The connection session starting date and time depends on the credentials.startDateTime provided and length of the session depends on the credentials.duration (in hours) provided.

(Note that providing an expired  credentials.startDateTime with credentials.duration will result in EXPIRED reason state in the systemAction event which indicates that Room session failed to start)


Read more about the init() method here


3. In the init() method, you will need to provide your Application Key and the related credential information specified below.


 

skylink.init({
  appKey: "<% APP_KEY %>",
  credentials: {
     startDateTime: "2016-02-07T09:12:41.630Z", // Date ISO string format
     duration: 2, // In hours
     credentials "xxxxxxxxxxxxx", // The generated credentials based off step 2
   }
});

 



When the above authentications fail, the readyStateChange event will return the related error code and message for the failure. You can refer to the list of error codes here.