Login events

    Login events


    Article summary

    The LOGIN_REQUIRED event is called when the player needs login information while running as a guest. (For example, when a guest clicks the chat button during live viewing.) You can use this event to insert code to redirect users to the login page.

    Sample code: Redirecting users to the login page when they try to access a feature that requires login

    <script type="text/javascript" src="https://static.shoplive.cloud/shoplive.js"></script>
    <script>
    const messageCallback = {
      LOGIN_REQUIRED: function(payload) {  
          alert("LOGIN_REQUIRED");  
          location.href = "YOUR_LOGIN_PAGE_URL";  
        }
    }
    cloud.shoplive.init({ accessKey: 'YOUR ACCESS KEY HERE', messageCallback: messageCallback });
    </script>


    What's Next