Search Unity

Question Economy authentication process

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

  1. lambch0p

    lambch0p

    Joined:
    Oct 22, 2014
    Posts:
    62
    Hi,

    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();
    4.  
    5.         options.SetEnvironmentName("development");
    6.         await UnityServices.InitializeAsync(options);
    7.  
    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

    lambch0p

    Joined:
    Oct 22, 2014
    Posts:
    62
  3. Laurie-Unity

    Laurie-Unity

    Unity Technologies

    Joined:
    Mar 5, 2020
    Posts:
    220
    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.