How to encode our user using JWT.IO lib ?

For better security, we do recommend using this method to encode your user data.
Your webmaster id param is 9999 and you password is secretPassword

List of Parameters to be encoded

webmasterid*: your webmasterid token

password*: your password

username*: username of the user

gender: Gender of user: must fit the genders defined in chatadmin - : male, female, couple By default is male

role: Role of the user: can be : admin, moderator, dj, user By default is user

image:Image or Avatar of the user : must be a link (https) to url of an image By default is random avatar

defaultRoom: Default room when enter the chat By default is the first room

So you do create your user like in php as an array:

        
            $password = 'secretPassword';
            $user = array('webmasterid'=>9999, 'password'=>$password, 'username'=>'John', 'gender'=>'male', 'role'=>'user', 'image'=>'https://html5-chat.com/img/avatars/m/13.svg');
        
Then you need to create an encrypted TOKEN from that user.
For that, we use jwt.io library
For PHP, we use for instance: https://github.com/firebase/php-jwt (if you use another langage, pick your library from jwt.io

Let do it with PHP


Step1: encode the user with JWT::encode

Create the $user array and encode it

    $password = 'secretPassword';
    $user = array('webmasterid'=>9999, 'password'=>$password, 'username'=>'John', 'gender'=>'male', 'role'=>'user', 'image'=>'https://html5-chat.com/img/avatars/m/13.svg');
    $encodedUser = JWT::encode($user, $password);


As result, $encodedUser will contain base64 long encrypted string (encryptedUser)
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ3ZWJtYXN0ZXJpZCI6OTk5OSwicGFzc3dvcmQiOiJzZWNyZXRQYXNzd29yZCIsInVzZXJuYW1lIjoiSm9obiIsImdlbmRlciI6Im1hbGUiLCJyb2xlIjoidXNlciIsImltYWdlIjoiaHR0cHM6XC9cL2h0bWw1LWNoYXQuY29tXC9pbWdcL2F2YXRhcnNcL21cLzEzLnN2ZyJ9.H3XTbOeRWAjoKbpHcoj_-LSenfQ4fp2Yy9hRAu8AZeA

Step2 : use that encoded script into your script

The pattern is:

        https://html5-chat.com/chat/{webmasterid}/{encryptedUser}
    

Directly to access your chat with link
            
                https://html5-chat.com/9999/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ3ZWJtYXN0ZXJpZCI6OTk5OSwicGFzc3dvcmQiOiJzZWNyZXRQYXNzd29yZCIsInVzZXJuYW1lIjoiSm9obiIsImdlbmRlciI6Im1hbGUiLCJyb2xlIjoidXNlciIsImltYWdlIjoiaHR0cHM6XC9cL2h0bWw1LWNoYXQuY29tXC9pbWdcL2F2YXRhcnNcL21cLzEzLnN2ZyJ9.H3XTbOeRWAjoKbpHcoj_-LSenfQ4fp2Yy9hRAu8AZeA            
        
Integrate your chat with a script:
            
                <script src="https://html5-chat.com/script/9999/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ3ZWJtYXN0ZXJpZCI6OTk5OSwicGFzc3dvcmQiOiJzZWNyZXRQYXNzd29yZCIsInVzZXJuYW1lIjoiSm9obiIsImdlbmRlciI6Im1hbGUiLCJyb2xlIjoidXNlciIsImltYWdlIjoiaHR0cHM6XC9cL2h0bWw1LWNoYXQuY29tXC9pbWdcL2F2YXRhcnNcL21cLzEzLnN2ZyJ9.H3XTbOeRWAjoKbpHcoj_-LSenfQ4fp2Yy9hRAu8AZeA"></script>