What is the best way to distinguish an Anonymous Account from a Unity Player Account one?

I have a trouble of distinguishing when I open my game for the second time.
Firstly, I can create an anonymous account OR link an anonymous account to Unity Player.
Or just log in as a player account.

When I open my game for the second time I use SignInAnonymously() to recover the existing credentials of my player, but when I do that I expect PlayerAccountService.Instance.IsSignedIn to be true. But
PlayerAccountService.Instance.IsSignedIn is false.

If I can’t distinguish Anonymous from Player Account after recovering, I don’t have a criteria to provide the option to link Anonymous account to a Player Account (if it is not linked yet).

What is the best practice for that case?

Could you post your code?

This shouldn’t be false UNLESS there’s an exception happening. Do you try/catch these?

Hi, thank you a lot for the answer and sorry for the delay…

On awake method:

    async void Awake()
    {
        UnityServices.Initialized += OnInitializationAsync;
        await UnityServices.InitializeAsync();
        SubscribeToAuthenticationEvents();
    }

that is how I subscribe:

    public void SubscribeToAuthenticationEvents()
    {
        PlayerAccountService.Instance.SignedIn += SignInWithUnity;
        AuthenticationService.Instance.SignedIn += OnAuthSignedIn;
        AuthenticationService.Instance.SignedOut += OnAuthSignedOutSuccess;
        AuthenticationService.Instance.SignedOut += ClearSessionToken;
        AuthenticationService.Instance.Expired += OnSessionExpiration;
        onLinkedInWithUnityFailed += SignOutFromPlayerAccountService;
    }

that is what is happening on OnInitializationAsync

    private async Task SetInitialAccountStateAsync()
    {
        if (!SessionTokenExists()) {
            AccountType = AccountType.None;
        }
        else
        {
            // If the session token exists, then the SignInAnonymouslyAsync()
            // method recovers the existing credentials of a player,
            // regardless of whether they signed in anonymously or through a platform account
            await MakeAnonymousLogin(retry: 5);
        }
        await UpdateAccountStateAsync();
        Debug.Log($"PlayerAccountService.Instance.IsSignedIn = {PlayerAccountService.Instance.IsSignedIn}");
        Debug.Log($"After Init Account type is [{AccountType}]");
    }
    public async Task MakeAnonymousLogin(int retry)
    {
        int attempts = retry;
        while (attempts > 0)
        {
            try
            {
                await SignInAnonymously();
                break;
            }
            catch (Exception ex)
            {
                Debug.Log($"Failed to login anonymously attempt-{retry - attempts + 1}: {ex}");
                attempts -= 1;
            }
        }
        Debug.Log($"After MakeAnonymousLogin Account type is [{AccountType}]");
    }

And in log I see:

PlayerAccountService.Instance.IsSignedIn = False =(