White Label Login

Create a custom login screen where players register their username and email address for one or all of your games and register a session for them on the LootLocker backend.

White Label Login provides a way for you to have an email/password login not tied to any of the big platforms.

This is great for more advanced use cases, like making it possible for your players to sign in on your website with the same account they're using in the game.

Configuration

Before using the SDK you must first enable and configure White Label Login in Platform Settings

Game/Company Name

This will be shown in emails sent to users as well as on the verify user/reset password page.

Sender Name

Shown as the sender in emails sent to users.

Reply-To Email

When users press reply in emails, this is the email used.

Enable Account Verification

If this is enabled, new White Label accounts will have have to verify their account. An email will be sent to them when they sign up, with a verification link.

Block Unverified Players

Only applies if Enable Account Verification is enabled. This will keep White Label users from starting LootLocker session until they have verified their account.

Isolate Unverified Players

If Block Unverified Players is disabled, this will make sure unverified accounts cannot submit scores to leaderboards.

Logo is used in emails sent to users as well as on the verify user/reset password page.

Remember Me Session Length

When logging in with White Label a remember me option can be supplied. This value determines for how many days the session is valid for.

Create a New User

Before we can register a session in the game, a user must first be created.

Passwords must be at least 8 characters long.

// Remember to use the LootLocker namespace in the top of your file.
using LootLocker.Requests;

// This code should be placed in a handler when user clicks the sign up button.
string email = "user@lootlocker.io";
string password = "password here";
LootLockerSDKManager.WhiteLabelSignUp(email, password, (response) =>
{
    if (!response.success)
    {
        Debug.Log("error while creating user");

        return;
    }

    Debug.Log("user created successfully");
});

Logging in and starting a session

White Label login works a little differently than other platforms in the sense that we first have to create a White Label login session, which is then used to create a game session. When the White Label Account is logged in the SDK will save the token and use it to create a Game Session.

The LootLocker SDKs provide a single method for the complete login flow. If you for some reason need to separate the steps, that is possible as well if you follow these instructions.

// Remember to use the LootLocker namespace in the top of your file.
using LootLocker.Requests;

// This code should be placed in a handler when user clicks the login button.
string email = "user@lootlocker.io";
string password = "password here";
bool rememberMe = true;
LootLockerSDKManager.WhiteLabelLoginAndStartSession(email, password, rememberMe, response =>
{
    if (!response.success)
    {
        if (!response.LoginResponse.success) {
            Debug.Log("error while logging in");
        } else if (!response.SessionResponse.success) {
            Debug.Log("error while starting session");
        }
        return;
    }

     // Handle Returning Player
}, rememberMe);

Congratulations - you have now started using LootLocker in your game! Next up we suggest you look at our feature set and decide which ones you want to use in your game.

Handle Returning Player

We don't want a player to have to type in their email and password every time they start the game, so for this we can reuse the session token provided by the WhiteLabelLogin call multiple times.

By default a session token is good for 24 hours, but if you send remember me to true a session will last for 30 days. Remember that these sessions are disconnected from the game session, so you still want to create a game session every time the player opens your game.

The length of a remember session can be changed in platform settings for White Label Login.

When a player opens the game we first want to check if they have a previous session we can use:

// Remember to use the LootLocker namespace in the top of your file.
using LootLocker.Requests;

LootLockerSDKManager.CheckWhiteLabelSession(response =>
{
    if (response)
    {
        // Start a new session
        Debug.Log("session is valid, you can start a game session");
    }
    else
    {
        // Show login form here
        Debug.Log("session is NOT valid, we should show the login form");
    }
});

Depending on the response from this code we can either show the login form and ask for email and password again or we can start a game session.

Request Password Reset

If the user wants to reset their password we can use the following example to send them an email with a link to a reset password page.

The page is hosted on LootLocker and will use the settings in Platform Settings for name and logo.

// Remember to use the LootLocker namespace in the top of your file.
using LootLocker.Requests;

// This code should be placed in a handler when user clicks reset password.
string email = "user@lootlocker.io";
LootLockerSDKManager.WhiteLabelRequestPassword(email, (response) =>
{
    if (!response.success)
    {
        Debug.Log("error requesting password reset");

        return;
    }

    Debug.Log("requested password reset successfully");
});

Request User Verification

If you want your White Label users to verify the provided emails then you can use the following example to do so. To use this however you need to have enabled account verification in the Platform Settings.

This requires you to have enabled Account Verification in Platform Settings.

// Remember to use the LootLocker namespace in the top of your file.
using LootLocker.Requests;

// This code should be placed in a handler when the user verifies their email.
int userId = 1234;
LootLockerSDKManager.WhiteLabelRequestVerification(userId, (response) =>
{
    if (!response.success)
    {
        Debug.Log("error requesting account verification");

        return;
    }

    Debug.Log("account verification requested successfully");
});

Congratulations - you have now started using LootLocker in your game with White Label Login! Next up we suggest you look at our feature set, and decide which ones you want to use in your game.

Last updated