Simple authentication

    Simple authentication


    Article summary

    This method involves manually inputting the ID and name of the logged-in user when executing the Shoplive player. It is utilized in situations where implementing JWT authentication between the client and server is challenging or when a rapid integration of Shoplive players is required.

    Property

    Description

    Sample

    Comment

    userId (Required)

    User ID

    sample_user_id

    A value that ensures the uniqueness of a logged-in user

    userName

    User name (Used in the chat window)

    my_nickname

    If you don't specify a name, you can force user input on chat or create it randomly according to the chat settings of the campaign.

    gender

    User gender

    Empty value (not specified),

    m (male),

    f (female)

    It allows checking the total/login viewers' data.

    age

    User age

    25

    It allows checking the total/login viewers' data.

    custom

    Custom data

    custom data

    Any data can be set up to 1KB. It allows checking the total/login viewers' data.

    userScore

    User rating

    10

    Setting the user rating allows using it as a standard for personalizing entrance and drawing events according to the rating. Integers are available from -100 to 100.

    userType

    User type

    VIP

    When entering a broadcast with set entry restrictions (Entry Type), you can reference this value to configure access exclusively for specific users (VIP).

    profile

    User profile image URL

    https://image.shoplive.cloud/sample_profile.png

    When displaying a profile image in the chat list of a broadcast, you can directly set the image path. The recommended image size is 64px X 64px. Please be cautious not to increase the image file size excessively.

    Refer to the sample code below.

    <script type="text/javascript" src="https://static.shoplive.cloud/shoplive.js"></script>
    <script>
    const userObject =
    	{    
      	userId: "{userID_here}", // required
        userName: "{userName_here}", // optional
        gender: "m", // optional
      	age: 25, // optional
      	custom: "custom data", // optional
      	userScore: 10, // optional
      	userType: "VIP", // optional
        profile: "https://image.shoplive.cloud/sample_profile.png", // optional
    	}
    );  
    //send with init
    cloud.shoplive.init({ accessKey: 'YOUR ACCESS KEY HERE', userObject});</script>
    
    <!-- OR -->
    
    <script type="text/javascript" src="https://static.shoplive.cloud/shoplive.js"></script>
    <script>
      const userObject =
    	{    
      	userId: "{userID_here}", // required    
        userName: "{userName_here}", // optional    
        gender: "m", // optional
      	age: 25, // optional
      	custom: "custom data", // optional    
      	userScore: 10, // optional
        userType: "VIP", // optional
        profile: "https://image.shoplive.cloud/sample_profile.png" // optional
    	}
    );  
    cloud.shoplive.init({ accessKey: 'YOUR ACCESS KEY HERE' });
    //send with setUserObject()
    cloud.shoplive.setUserObject(userObject);
    </script>