iOS / Android
When launching a game on iOS or Android devices, you do not need to authenticate the player with any platform. Therefore, your first API call should be
LootLockerSDKManager.StartSession. This call only requires you to send a
playerIdentifierwhich can be any string you use to identify your players.
Create a new C# Script and copy the script below and paste it there.
// Remember to use the LootLocker namespace in the top of your file
// This code should go in your Start() method
string playerIdentifier = "unique_player_identifier_here";
LootLockerSDKManager.StartSession(playerIdentifier, (response) =>
Debug.Log("session with LootLocker started");
Debug.Log("failed to start sessions" + response.Error);
The syntax in this snippet is easy to understand and is described below:
LootLockerSDKManager: Our SDK Manager script. You can view this yourself to see all the functions we support
StartSession: The function in the SDK you need to call
playerIdentifier: The data to send to the SDK to make a session call. This should be unique to the player as it allows for really fast authentication without the need for a username or password. You could generate a Unique ID for your players and save this somewhere on the device or you can decide to use a device identifier and link the player's account to the player's device.
Upon a successful session registration, you will receive the following response.
This means you can easily use
response.successto get the success value from the JSON response from the server.
ULootLockerSDKManager::StartSession(PlayerId, FLootLockerSessionResponse::CreateUObject(this, &ADemoAuthentication::OnStartSessionCompleted));
//Example callback method
void ADemoAuthentication::OnStartSessionCompleted(FAuthenticationResponse Response)
UE_LOG(LogTemp, Verbose, TEXT("OnStartSession Success"));
UE_LOG(LogTemp, Verbose, TEXT("OnStartSession Failed"));
successboolean used in the snippet above, we also return a host of other data, such as the player’s ID, if they are a new or returning user etc. If you would like to dive deeper into this
SessionResponse, you can find the code for the SDK on GitHub.