Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Question Economy authentication process

Discussion in 'Economy' started by lambch0p, Nov 27, 2021.

  1. lambch0p


    Oct 22, 2014

    I've built a basic PoC store and have hooked it up to Economy and IAP.

    When I debug in the Unity editor, I can see that Economy gets initialized and the anonymous authentication occurs successfully.

    On one of my Android devices, I can also see the anonymous authentication taking place (I chuck debug messages to a UIToolkit label in a scrollview). Probably irrelevant, but this device is one that i've used for testing APKs of my previous games.

    On a different Android device that is receiving the game through the internal testing track of the play store, I can see that the authentication never occurs. There aren't any errors but the delegate doesn't seem to be getting called as the messages aren't printed.

    Code (CSharp):
    1.     private async Task InitializeEconomy()
    2.     {
    3.         var options = new InitializationOptions();
    5.         options.SetEnvironmentName("development");
    6.         await UnityServices.InitializeAsync(options);
    8.         AuthenticationService.Instance.SignedIn += delegate
    9.         {
    10.             m_LabelConsole.text += "\nAll signed in and ready to go!";
    11.             m_LabelConsole.text += $"\nPlayer ID is {AuthenticationService.Instance.PlayerId}";
    12.             //m_LabelConsole.text += $"\nAccess Token is {AuthenticationService.Instance.AccessToken}";
    13.         };
    14.         if (AuthenticationService.Instance.IsSignedIn != true)
    15.         {
    16.             await AuthenticationService.Instance.SignInAnonymouslyAsync();
    17.         }
    18.         //FetchRealMoneyPurchases();
    19.     }
    Is there an additional step that I have failed to complete that would allow the authentication to complete on my second device? I've no idea why it's working on the first one, which also received the app through the play store.
  2. lambch0p


    Oct 22, 2014
  3. Laurie-Unity


    Unity Technologies

    Mar 5, 2020
    Hi There,

    I've checked your code and can confirm that it should work fine.

    Cross-posting the reply from the Authentication thread for visibility:

    The SSL / CA Error that you are receiving is down to the Android version on one of your devices.

    I have tested your code sample succussfully on API 25 and above and am currently seeking confirmation on the minimum version required.