Sometimes we or the player want to disconnect an identity provider from their account. In this how-to we'll explain how to disconnect a provider from a player's account in a safe manner.
Prerequisites
Before we begin, ensure you have the following:
- A game created in the LootLocker web console
- An active LootLocker session with multiple connected providers
To learn how to connect providers to a player's account, you can read our documentation on Connecting Providers to a Player
List Connected Accounts
We first get a list of connected accounts to see which providers are connected to the player's account.
LootLockerSDKManager.ListConnectedAccounts((response) =>{ // Optional handling of case where only 1 provider is left on the player if (response.connected_accounts.Length == 1) { Debug.Log("Player has only 1 account connected. Disconnecting this provider will leave the player without any connected providers."); return; }
Debug.Log("Player has " + response.connected_accounts.Length.ToString() + " accounts connected.");
// Log all connected accounts to the console foreach (var account in response.connected_accounts) { Debug.Log("Connected with: " + account.provider_name); }});
The reference documentation for this call can be found here
curl -X "https://api.lootlocker.io/game/v1/connected-accounts" \ -H "x-session-token: your_token_here"Disconnect Account
Now we have a list of connected accounts, we can disconnect one of them.
// The following providers are supported:// LootLocker.LootLockerEnums.LootLockerAccountProvider.guest;// LootLocker.LootLockerEnums.LootLockerAccountProvider.google;// LootLocker.LootLockerEnums.LootLockerAccountProvider.apple;
// We'll use Apple for this examplevar account = LootLocker.LootLockerEnums.LootLockerAccountProvider.apple;
LootLockerSDKManager.DisconnectAccount(account, (response) =>{ if(!response.success) { Debug.Log("Could not disconnect account"); return; }
Debug.Log("Successfully disconnected account");});
The reference documentation for this call can be found here
curl -X DELETE "https://api.lootlocker.io/game/v1/connected-accounts/apple" \ -H "x-session-token: your_token_here"Conclusion
In this how-to we've shown you how to disconnect an identity provider from a player. If you want to learn more, you can read about how to connect a provider or our general Unified Player Account documentation.
