Links

Sign in with Apple

Apple platform needs to be enabled and configured in the Web Console before it can be used in your game. This also requires you to have a developer account with Apple.

Configuration

To start using Sign in with Apple we first need to configure our integration in the platform settings

Team ID

You can find your Apple Team ID by logging in to the Apple developer portal and going to the Membership page. On that page you should be able to see your Team ID.

Client ID

Client ID will in most cases be the bundle identifier for your App when you created it in Xcode or in the Apple developer portal.

Key ID & Certificate

After logging in to your Apple developer portal, navigate to the "Certificates, Identifiers & Profiles" page. From here you can create a new key.
When creating a key, make sure to enable "Sign in with Apple" and pressing the configure button. The "Primary App ID" should be the same as your game (bundle identifier)
When finished creating your key, make sure you download the certificate, which we will upload in the LootLocker Console.
The Key ID can be seen when clicking the key after creation in the Apple developer portal.

Start Session

You need to acquire an Apple authorization code to be able to start an apple session, but once you have that, simply follow along to the code snippet below. In the response from LootLocker you will find a refresh token. You can store this and use it to refresh the session during the lifetime of the refresh token so that you do not need to do the full sign in flow each time.
Unity
// authCode can be retrieved from appleIDCredential.authorizationCode
string authCode = "put authorizationCode here";
LootLockerSDKManager.StartAppleSession(authCode, (response) =>
{
if (!response.success)
{
Debug.Log("error starting LootLocker session");
return;
}
Debug.Log("session started successfully");
// Store these to be able to refresh the session without using the full sign in flow
string refreshToken = response.refresh_token;
string playerIdentifier = response.player_identifier;
});

Refresh Session

To refresh a previous session, you will need to have saved the refresh token and player identifier from a previous sign in call. When you have that simply follow along to the code snippet below. The request will return a 401 (Unauthorized) if the refresh token has expired.
Unity
LootLockerSDKManager.RefreshAppleSession(playerIdentifier, refreshToken, (response) =>
{
if (!response.success)
{
if (response.statusCode == 401) {
// Refresh token has expired, use StartAppleSession
}
else {
Debug.Log("error starting LootLocker session");
}
return;
}
Debug.Log("session started successfully");
});
Last modified 9d ago