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 player is logged in, the SDK will save the token, so you don't have to send it to StartWhiteLabelSession
// Remember to use the LootLocker namespace in the top of your file.usingLootLocker.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.WhiteLabelLogin(email, password, rememberMe, response =>{if (!response.success) {Debug.Log("error while logging in");return; }string token =response.SessionToken; // Start game session here});
Above is an example of how to implement White Label login using blueprints in Unreal Engine. For an example you can copy and paste into your editor, look here.
Input
You need to exchange the TriggerWhiteLabelLoginevent for whatever event you want to use to trigger the login flow.
Remove the nodes Replace: Input with the email and password input from the user input in your game.
Output
We recommend branching the completed events on the success flag, and if you do this you will probably want to add error handling in case the request fails as well as what (if any) continued actions you want on success.
Register a Game Session
After creating a session token we can register a game session. When the session has been registered you can use other LootLocker features in your game.
// Remember to use the LootLocker namespace in the top of your file.usingLootLocker.Requests;// This code should be placed in a handler when user clicks login button.LootLockerSDKManager.StartWhiteLabelSession((response) =>{if (!response.success) {Debug.Log("error starting LootLocker session");return; }Debug.Log("session started successfully");});
Above is an example of how to implement starting a game session from a White Label login using blueprints in Unreal Engine. For an example you can copy and paste into your editor, look here.
Input
You need to exchange the TriggerWhiteLabelStartGameSessionevent for whatever event you want to use to trigger the login flow.
Output
We recommend branching the completed events on the success flag, and if you do this you will probably want to add error handling in case the request fails as well as what (if any) continued actions you want on success.
For subsequent calls to different LootLocker methods you will want to create variables from the Player Id and Player Identifier outputs.
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.