#Unity Authentication with Game Center Minimum Setup?

1 messages · Page 1 of 1 (latest)

weak heath
#

Hello,

I purchased this Essential Kit because implementing it with iOS native plugins has been challenging, especially since fetching items doesn't work as expected.

Could you please provide the minimum setup required to authenticate and fetch the signature, teamPlayerID, publicKeyUrl, salt, and timestamp using your plugin? I saw a response in the Unity forum that mentioned your plugin works for this issue, and I also received confirmation from your support email before purchasing.

Can I remove the Apple.Core and Apple.Gamekit packages that I previously installed after integrating this plugin?

Edit:
3. I found that I could retrieve the necessary values for Unity Authentication from ServerCredentials in your EssentialsKit. However, Unity's documentation advises fetching these values again before reusing them as they may become outdated (teamPlayerID, publicKeyUrl, salt, timestamp). I haven't found a way to refresh these values through your plugin.

Thank you.

urban snow
#

There is no refresh, afaik. Can you please pass on the doc reference.

Our plugin doesn't depend on any external code or dependencies (except fot EDMU as we need to for cross plugin compat). You can safely delete apple plugins as well as GPGS from github for android if you have added.
@weak heath

weak heath
# urban snow There is no refresh, afaik. Can you please pass on the doc reference. Our plugi...

I've implemented everything else on my own. My sole purpose was to authenticate Unity with Game Center. I managed to do this with a fix found in a Unity discussion, but it would be great to have documentation for a minimum setup specifically for this purpose. It seems like many people are struggling with it, and there's no straightforward solution. If your plugin offers a simple, straightforward setup for this, I would consider switching to it.

urban snow
#

Thankyou!
Sure! I will make a separate document on how to use this for this specific case. Glad for sharing the steps to make it simple. Really appreciate it.

weak heath
urban snow
#

I'm working on a demo currently. Will get you the tutorial by tomorrow.

weak heath
urban snow
#

Sure. Let me give a brief here so you can continue meanwhile

weak heath
urban snow
#
  1. Import namespace
using VoxelBusters.CoreLibrary;
using VoxelBusters.EssentialKit;
  1. Call GameServices.Authenticate which will fire GameServices.OnAuthStatusChange event on completion of authentication with a status
  2. If authentication status is successful, call GameServices.LoadServerCredentials
GameServices.LoadServerCredentials((result, error) =>
                    {
                        if(error == null)
                        {
                            LogServerCredentials(result.ServerCredentials);
                        }
                        else
                        {
                            Log("Loading server credentials failed with error. Error: " + error);
                        }
                    });
  1. LoadServerCredentials returns ServerCredentials object which has IosProperties
if(credentials.IosProperties != null)
            {
                Log("Public key Url : " + credentials.IosProperties.PublicKeyUrl);
                Log("Signature length : " + credentials.IosProperties.Signature.Length);
                Log("Salt length : " + credentials.IosProperties.Salt.Length);
                Log("Timestamp : " + credentials.IosProperties.Timestamp);
            }
weak heath
#

the result return always null reference exception when i call an iOS property

#

ive put a few more debugs in there to test

weak heath
#

In the editor settings, I disabled everything except GameServices and entered the iOS Store ID (a 10-digit number) under the General tab.

urban snow
weak heath
#

Normally i always find a way to test anything else and get to the point it just works but iam totally stuck now i dont know what else to test. LoadServerCredentials callback never returns a valid value

urban snow
#

Ok, as per the log I see you have INVALID_PARAMETERS once you pass the credentials details to your server?

weak heath
#

Yes because iam passing null parameters to the unity authentication sign in function as soon as i debug.log any result value from the callback it prints me error logs.

#

async Task SignInWithAppleGameCenterAsync(string signature, string teamPlayerId, string publicKeyURL, string salt, ulong timestamp)

urban snow
#

Oh ok, got it.

#

Can you please do one thing? You can just use 2.7.3 for this. No patches are required. The one you found on discord are for 2.7.2 release.

  1. Open GameServicesDemo scene and build for ios
  2. Run it and click on Authenticate
  3. Scroll down and click on LoadServerCredentials
weak heath
#

ok let me check real quick

#

Will this even work without it published to the store?

weak heath
#

entering store id is not necessary?

urban snow
weak heath
#

kk

urban snow
#

Store Id, we collect for Rate app - in case if dev prefers to open store link instead of default native rate dialog. As its something global, its in general section. You can ignore it.

weak heath
#

Building should be done in 2-3 minutes

urban snow
#

No problem. I will be around.

weak heath
#

Getting the right responses

#

Ill check out the implementation

urban snow
#

One thing I see different is - Async implementation.
Thought to support Async but thats too much work and delays V3 further, so may take it up later.

weak heath
#

No problem ill find a way if it works in the demo. I didnt knew you had that implemented already. Because i only saw about 2-3 people asking about that in discord

urban snow
urban snow
#

Anyways, As soon as you need any help, please ping here. I will reply at the earliest possible (+5.30 GMT timezone - India)

weak heath
urban snow
#

GameServicesDemo can be good reference to cross check anything and will be handy.

weak heath
urban snow
weak heath
#

I experienced the same issue with AdMob. Even though all callbacks were forced to be on the main thread, they still weren’t. I added PimDeWitte.UnityMainThreadDispatcher to double-force the callbacks, and as a result, the reported crashes in the Play Console dropped from 5% to 0.1%.

weak heath
#

It just works out of the box with my async methods.

urban snow
#

Oh 😄

weak heath
# urban snow Oh 😄

I replaced everything from.my Google implementation and used your implementation, but the only annoying issue I encountered is that it doesn't follow the usual flow when using Google Play Games directly. The player has to accept the login, whereas typically, the Google popup appears without requiring any user action.

Could this be because you're only using the client ID and not the client secret?

urban snow
urban snow
#

Yes, ofcourse!

#

Can I arrange you by tomorrow?

#

We have a new beta release in couple of days.

weak heath
weak heath
# urban snow Can I arrange you by tomorrow?

Another thing i just realized your implementation is wrong for the android logic when getting a second time server credentials. Google requires to aquire a new auth token after every use your function LoadServerCredentials returns for the second time called the same ServerAuthCode like on the first call.

urban snow
#

V3 provides option to fetch auth code along with refresh token

weak heath
#

Ah, okay, cool. I'll just wait for it then. I tried to make the changes myself in your code, but it seems like the functions are intentionally obfuscated, making it difficult to track down. 🙂

urban snow
#

Which functions?

weak heath
# urban snow Which functions?

for example:

protected void _Call(string methodName, params object[] args)
{
    IntPtr methodID = AndroidJNIHelper.GetMethodID(m_jclass, methodName, args, isStatic: false);
    _Call(methodID, args);
}
urban snow
#

Well thats from unity dll

weak heath
urban snow
#

I mean androidjnihelper

#

I need to cross check few things before I pass on the beta , so...

#

If you want I can send it over. Meanwhile you can check it. But will send another one in 2 days if any fixes required.

#

If thats ok, i can send it right now.

weak heath
#

Yea sure

#

i wont publish it live to my game its just that i can continue working and testing

urban snow
#

Ok then. Pls give me an hour to send it over.