# Transition from Guest Login to Other Provider

In this how-to, we'll explain how to transition a player from a guest account to another provider.

A common flow in games is to get the player started playing as quickly as possible, and then later transition them to a more permanent authentication type, which also allows them to easily authenticate on other devices, We achieve this by starting them out with a guest account, which requires no input from the player, and then later nudging them to link their account with a different provider, like Apple or Google.

## Prerequisites

Before we begin, ensure you have the following:

* [A game created in the LootLocker web console](/the-basics/readme.md)
* [UPA configured in the LootLocker web console](https://github.com/lootlocker/gitbook-sync/blob/main/players/unified-player-accounts/how-to/configuration.md)
* [A player with a guest account](https://github.com/lootlocker/gitbook-sync/blob/main/players/authentication/guest-login.md)

## Transitioning a Player

To start transitioning the player from guest to another provider, we first need to authenticate the player with the new provider. This will give us the necessary token to connect the accounts.

In this example we'll use Apple sign in, but you can exchange this with another provider.

For more in depth information on how to authenticate with different providers, read our documentation on [Authentication](/players/authentication.md)

Note that we don't start actually start a LootLocker game session using the new provider, we only do the local authentication with Apple to get the required token.

{% tabs %}
{% tab title="Unity" %}

```csharp
// The token retrieved from authenticating with Apple in the game client
string token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.0.xxxxx.xxxxxxxx-xxxxxxxxxxxxx";
LootLockerSDKManager.ConnectAppleAccount(token, (response) =>
{
    if(!response.success)
    {
        Debug.Log("Error connecting Apple");
        return;
    }

    Debug.Log("Successfully connected Apple");
});
```

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="/files/DEqTe5EhOLwroIhFJcmw" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/i0rj-nc4/">Blueprint example of connecting Apple account</a></p></figcaption></figure>
{% endtab %}

{% tab title="REST" %}
Specific reference for providers are here:

* [Apple](https://ref.lootlocker.com/game/upa/connected-accounts/connect-apple-account)
* [Google](https://ref.lootlocker.com/game/upa/connected-accounts/connect-google-account)

The following example is for Apple:

```bash
curl -X PUT "https://api.lootlocker.io/game/v1/connected-accounts" \
    -H "x-session-token: your_token_here" \
    -H "Content-Type: application/json" \
    -d '{"authorization_code": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.0.xxxxx.xxxxxxxx-xxxxxxxxxxxxx"}'
```

{% endtab %}
{% endtabs %}

After connecting the account, we can then disconnect the guest account. If we do not do this, the player will still be able to log in as a guest, which might not be what we want.

{% tabs %}
{% tab title="Unity" %}

```csharp
// The following providers are supported:
// LootLocker.LootLockerEnums.LootLockerAccountProvider.guest;
// LootLocker.LootLockerEnums.LootLockerAccountProvider.google;
// LootLocker.LootLockerEnums.LootLockerAccountProvider.apple;

var account = LootLocker.LootLockerEnums.LootLockerAccountProvider.guest;

LootLockerSDKManager.DisconnectAccount(account, (response) =>
{
    if(!response.success)
    {
        Debug.Log("Could not disconnect account");
        return;
    }

    Debug.Log("Successfully disconnected account");
});
```

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="/files/LcxtfAAqnxlgdpOZotVY" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/vtkfo2vu/">Blueprint example of disconnecting Apple account</a></p></figcaption></figure>
{% endtab %}

{% tab title="REST" %}
The reference documentation for this call can be found [here](https://ref.lootlocker.com/game/upa/connected-accounts/unlink-platform-provider)

```bash
curl -X DELETE "https://api.lootlocker.io/game/v1/connected-accounts/apple" \
    -H "x-session-token: your_token_here"
```

{% endtab %}
{% endtabs %}

You can also read our dedicated how-to for disconnecting an account [here](/players/unified-player-accounts/how-to/disconnect-provider.md)

## Conclusion

By following this how-to guide, you should now have a better understanding of how to transition a player from a guest account to another provider.

To learn more about account linking, you can read our documentation on connecting multiple providers to a player [here](/players/unified-player-accounts/how-to/connect-provider-to-player.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lootlocker.com/players/unified-player-accounts/how-to/transition-guest-player.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
