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 30162 and you password is 5fec52323ae04

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 = '5fec52323ae04';
            $user = array('webmasterid'=>30162, '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 = '5fec52323ae04';
    $user = array('webmasterid'=>30162, '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.eyJ3ZWJtYXN0ZXJpZCI6IjMwMTYyIiwicGFzc3dvcmQiOiI1ZmVjNTIzMjNhZTA0IiwidXNlcm5hbWUiOiJKb2huIiwiZ2VuZGVyIjoibWFsZSIsInJvbGUiOiJ1c2VyIiwiaW1hZ2UiOiJodHRwczpcL1wvaHRtbDUtY2hhdC5jb21cL2ltZ1wvYXZhdGFyc1wvbVwvMTMuc3ZnIn0.Mja12870AQDD3--AnzLcvZueNxq6ye2rePgHr25R11w

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/30162/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ3ZWJtYXN0ZXJpZCI6IjMwMTYyIiwicGFzc3dvcmQiOiI1ZmVjNTIzMjNhZTA0IiwidXNlcm5hbWUiOiJKb2huIiwiZ2VuZGVyIjoibWFsZSIsInJvbGUiOiJ1c2VyIiwiaW1hZ2UiOiJodHRwczpcL1wvaHRtbDUtY2hhdC5jb21cL2ltZ1wvYXZhdGFyc1wvbVwvMTMuc3ZnIn0.Mja12870AQDD3--AnzLcvZueNxq6ye2rePgHr25R11w            
        
Integrate your chat with a script:
            
                <script src="https://html5-chat.com/script/30162/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ3ZWJtYXN0ZXJpZCI6IjMwMTYyIiwicGFzc3dvcmQiOiI1ZmVjNTIzMjNhZTA0IiwidXNlcm5hbWUiOiJKb2huIiwiZ2VuZGVyIjoibWFsZSIsInJvbGUiOiJ1c2VyIiwiaW1hZ2UiOiJodHRwczpcL1wvaHRtbDUtY2hhdC5jb21cL2ltZ1wvYXZhdGFyc1wvbVwvMTMuc3ZnIn0.Mja12870AQDD3--AnzLcvZueNxq6ye2rePgHr25R11w"></script>