iOS / Android
The guide bolow is outdated and should no longer be used for new integrations with LootLocker.
For games running on iOS and/or Android we recommend you use the Guest Login platform instead.
If you're interested in using Sign in With Apple or Google Play in your game, please reach out to us on our Discord.

Authenticate Player

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 playerIdentifier which can be any string you use to identify your players.
We recommend using the unique device identifier for player_identifier.
Unity
Unreal

Start Session

Create a new C# Script and copy the script below and paste it there.
Unity
1
// Remember to use the LootLocker namespace in the top of your file
2
using LootLocker.Requests;
3
4
// This code should go in your Start() method
5
string playerIdentifier = "unique_player_identifier_here";
6
LootLockerSDKManager.StartSession(playerIdentifier, (response) =>
7
{
8
if (response.success)
9
{
10
Debug.Log("session with LootLocker started");
11
}
12
else
13
{
14
Debug.Log("failed to start sessions" + response.Error);
15
}
16
});
Copied!
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.

Start Session Response

Upon a successful session registration, you will receive the following response.
1
{
2
"success": true,
3
4
"session_token": "e6fa44946f077dd9fe67311ab3f188c596df9969",
5
6
"player_id": 3,
7
8
"public_uid": "TSEYDXD8",
9
10
"check_grant_notifications": true,
11
12
"check_deactivation_notifications": false,
13
14
"seen_before": true
15
}
Copied!
This means you can easily use response.success to get the success value from the JSON response from the server.

Start Session

C++
Blueprint
1
void ADemoAuthentication::DemoStartSession()
2
{
3
ULootLockerSDKManager::StartSession(PlayerId, FLootLockerSessionResponse::CreateUObject(this, &ADemoAuthentication::OnStartSessionCompleted));
4
}
5
6
//Example callback method
7
void ADemoAuthentication::OnStartSessionCompleted(FAuthenticationResponse Response)
8
{
9
if (Response.success)
10
{
11
UE_LOG(LogTemp, Verbose, TEXT("OnStartSession Success"));
12
}
13
else
14
{
15
UE_LOG(LogTemp, Verbose, TEXT("OnStartSession Failed"));
16
}
17
}
Copied!
Besides the success boolean 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.
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.
If you want to store your player’s inventory with LootLocker (this allows use of a lot more features, such as granting assets to players on level up, when completing a mission, etc) a great next step is to read up on the Asset Manager.
Last modified 13d ago
Copy link