SignInAnonymouslyAsync Token expire error using Remote Config

Hello,
I’m using the following code to initialize the remote config :

private static async Task InitializeRemoteConfigAsync()
    {
        if (UnityServices.State == ServicesInitializationState.Uninitialized)
        {

            try
            {
                await UnityServices.InitializeAsync();
            }
            catch (Exception ex)
            {
                Debug.LogError("Unity service autentication faled in InitializeRemoteConfigAsync methos. Error " + ex.Message);
            }
            // initialize handlers for unity game services
        
        }

        // options can be passed in the initializer, e.g if you want to set analytics-user-id or an environment-name use the lines from below:
        // var options = new InitializationOptions()
        //   .SetOption("com.unity.services.core.analytics-user-id", "my-user-id-1234")
        //   .SetOption("com.unity.services.core.environment-name", "production");
        // await UnityServices.InitializeAsync(options);

        // remote config requires authentication for managing environment information
        if (!AuthenticationService.Instance.IsSignedIn)
        {

            try
            {
                await AuthenticationService.Instance.SignInAnonymouslyAsync();
            }
            catch (Exception ex)
            {
                Debug.LogError("SignInAnonymouslyAsync in InitializeRemoteConfigAsync methos. Error " + ex.Message);
            }

        }
    }

Everything works fine on the Editor, I’m also able to retrieve the data from the remote Config backend, the problem is when I built on the device where I get the error that you can find attached, What I’m doing wrong?
If remove the authentication code, the Remote config seems to work fine but I have a lot of warnings says:
uth Service not initialized.
Request might result in empty or incomplete response

Hello,

I noticed from the screen shot that the system date is set to four days ahead (22-08-22) Can you confirm this? If so you will need to set the device date to the current date as we validate player time on the client side.

Hope that helps!

2 Likes

Thanks that solved the problem, I was testing the local push notification and I had to change the date of the device

Hey guys,
is there a way to manually set date/time of the AuthenticationService to prevent this in general?

We already verifying our own time (server-side), so our game is not affected if a user is manipulating his device-time (for whatever reason).