7. Login

Please wait until login succeed before using any other API functions.

Call wakool.login() in the SDK loaded callback:

wakool.login(function(result) {
  if (result) {
    /** 
     *  console.log('Login success! Now Wakool SDK is fully functional.', result);
     */
  } else {
    /**
     *  console.log('Login failed!');
     */
  }
});

When login succeed, the result contains a JSON object:

{
  "id": "{USERS_ID}",
  "nickname": "{NICKNAME}"
}

id: The id of the user in Wakool platform.
nickname: The nickname of the user.

7.1. Guest mode

Some platforms allowing users to play game in guest mode where user logged into the platform with a randomly generated temp account. Game developers should be aware that many functions aren't allowed in guest mode such as purchase or awarding, etc. Whether the user is in guest mode can be checked with the isDemoUser() API.

※ This function is available since SDK version 3.0.3

7.1.1. API for checking whether the user is in guest mode

wakool.isDemoUser();

7.1.2. Return value

Return true if the user is in guest mode, otherwise return false.

Example:

wakool.login(function(result) {
  if (result) {
    if (wakool.isDemoUser()) {
        /** 
         *  console.log('The user is in guest mode!');
         */
    }   
  }
});

7.2. Login prompt for guest users

When a guest user trying to access functions reserved for logged in users, developers may show the login prompt asking user to login with their social account.

※ This function is available since SDK version 3.0.6

7.2.1. API for showing login prompt for guest users

wakool.loginRequired();

Example:

<a onclick="wakool && wakool.isDemoUser() && wakool.loginRequired()">Login</a>

7.3. Character Creation

※ This function is available since SDK version 3.0.5

7.3.1. Description

To make advertising delivery more efficient, user acquisition must be accurately tracked. Wakool platform should be notified when player actually starting to play, usually when they created their character, to be able to distinguish from users immediately bounced. In advertising terminology it is called Complete Registration.

7.3.2. API to notify the platform when user has created their character:

wakool.completeRegistration(server_id, character_id);

Parameters:

parameter name description
server_id The id of the server the user is playing (when applicable)
character_id The id of the player character (when applicable)

results matching ""

    No results matching ""