js-calls-part-1-index-js-authenticate

Home   »   js-calls-part-1-index-js-authenticate

/**
* To be able to make and receive calls, a user must be authenticated
*/
function authenticateUser() {
   const authOption = {
       userId: document.getElementById('USER_ID').value,
       accessToken: document.getElementById('ACCESS_TOKEN').value
   };
   SendBirdCall.authenticate(authOption, (res, error) => {
       if (error) {
           console.dir(error);
           alert(`Error authenticating user! Is your Access
           / Session token correct? This user exists?`);
       } else {
           connectToWebsocket();
       }
   });   
}

Leave a Reply

Your email address will not be published. Required fields are marked *