Any reason why the plugin would work fine when not using 'RequestServerAuthCode(false)' on InitializeInstance but results in ERROR_NOT_AUTHORIZED when included?
using latest version of the plugin 0.9.39a, verified SH1 fingerprint, OAuth ids and package name.
This code used to work until I updated to the latest version so not sure why it would stop.
Works:
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
Doesn't work:
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().RequestServerAuthCode(false).Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
OK, I found the issue.
It was 2 part problem.
I was running into issues as initially I didn't realize the new version of the plugin now requires you to preemptively "RequestServerAuthCode(false)" when initializing the Service.
Basically, the mistake I made was I thought I had to make the Unity Setup use a 'android' OAuth ID and not a 'web' OAuth ID. But that issue was obscured by another issue.
So after going around checking everything I found that I wasn't initializing the service ".RequestServerAuthCode(false)" sufficiently early enough in initialization as now this is a required setting in order to have access to AuthCodes. If you don't do it early enough, it auto initializes and then prevents you from ever getting access to AuthCodes.
I posted this issue after fixing all my code but not realizing the OAuth code wasn't the one the service uses.
I realize it's clear in the dialog and so that mistake is on me, however it seems a little strange that the setup needs a Web auth code when we're developing for Android? I.e. I spent a bunch of time checking SHA1 fingerprint values app ids etc but they're not used when building from unity?
Can I suggest that the 'RequestServerAuthCode' be built into the 'setup' of the service within unity? That way we don't need to try and sufficiently preempt the static initialization of the service.
Thank you very much. You are probably the only person on the Internet who has solved this problem. I also used the second solution. However, this was exactly what I needed to integrate the project in Unity (where the web 'OAuth ID is optional and consequently unused) with Firabase, and it took me a whole two months to do alternate methods. I decided to go back to the source and found your post.
Most helpful comment
OK, I found the issue.
It was 2 part problem.
I was running into issues as initially I didn't realize the new version of the plugin now requires you to preemptively "RequestServerAuthCode(false)" when initializing the Service.
Basically, the mistake I made was I thought I had to make the Unity Setup use a 'android' OAuth ID and not a 'web' OAuth ID. But that issue was obscured by another issue.
So after going around checking everything I found that I wasn't initializing the service ".RequestServerAuthCode(false)" sufficiently early enough in initialization as now this is a required setting in order to have access to AuthCodes. If you don't do it early enough, it auto initializes and then prevents you from ever getting access to AuthCodes.
I posted this issue after fixing all my code but not realizing the OAuth code wasn't the one the service uses.
I realize it's clear in the dialog and so that mistake is on me, however it seems a little strange that the setup needs a Web auth code when we're developing for Android? I.e. I spent a bunch of time checking SHA1 fingerprint values app ids etc but they're not used when building from unity?
Can I suggest that the 'RequestServerAuthCode' be built into the 'setup' of the service within unity? That way we don't need to try and sufficiently preempt the static initialization of the service.