Skip to content

Use Remote Login In-Game

Remote login makes it easy to start LootLocker sessions on devices where entering credentials is hard, like on console. It also lets games implement first-party provider authentication without spending a long time manually implementing it into their game client.

  1. Initiate the remote login process, which returns a URL and QR code the player can use to log in.
  2. The player visits the URL and logs in using their preferred identity provider.
  3. The game client polls the server to check if the player has logged in yet.
  4. Once the player has logged in, the poll returns a success response with a LootLocker session and a refresh token.
  5. The next time the player opens the game, the refresh token can be used to start a new session without going through the full flow again.

This function requires three separate callbacks, which are easier to manage as follows:

public void RemoteLease()
{
LootLockerSDKManager.StartRemoteSession(leaseAction, pollingAction, onComplete);
}
Action<LootLockerLeaseRemoteSessionResponse> leaseAction = (info) =>
{
if (!info.success)
{
Debug.Log("Couldnt start Remote leasing");
return;
}
};
Action<LootLockerRemoteSessionStatusPollingResponse> pollingAction = (polling) =>
{
if(!polling.success)
{
Debug.Log("Couldnt poll Remote leasing");
return;
}
};
Action<LootLockerStartRemoteSessionResponse> onComplete = (onComplete) =>
{
if (!onComplete.success)
{
Debug.Log("Couldnt start Remote leasing");
return;
}
};

If you want to cancel the process partway through, here's how.

LootLockerSDKManager.StartRemoteSession returns a Guid you can later use to cancel the remote session start process.

public void RemoteLease()
{
var leasedGuid = LootLockerSDKManager.StartRemoteSession(leaseAction, pollingAction, onComplete);
LootLockerSDKManager.CancelRemoteSessionProcess(leasedGuid);
}

The response from creating a remote session includes a refresh token. This token can be used to start a new session without the player having to go through the full flow again.

LootLockerSDKManager.RefreshRemoteSession((onComplete) =>
{
if(!onComplete.success)
{
Debug.Log("Couldnt refresh remote session!");
return;
}
});

With a manually stored refresh token:

string refreshToken = "";
LootLockerSDKManager.RefreshRemoteSession(refreshToken, (onComplete) =>
{
if(!onComplete.success)
{
Debug.Log("Couldnt refresh remote session!");
return;
}
});

You've started and managed remote sessions from your game. To learn more about UPA, read about Connected Accounts or the general Unified Player Accounts page.