Using Unity 2019 along with Google's Google Play Games Unity plugin.
I've seen this issue crop up in the questions a couple of times, however none of the answers have fixed this issue for me. I successfully authenticate with Google Play Services and obtain a ServerAuthCode. However, when trying to authenticate with PlayFab using LoginWithGoogleAccount request I receive the error report: "Google API error code: invalid_client details: Unauthorized".
Here's a quick breakdown of steps I've taken:
1. Followed and implemented the instructions at least 3 times: https://docs.microsoft.com/en-us/gaming/playfab/features/authentication/platform-specific-authentication/google-sign-in-unity
2. Created a linked web app on Google Play Console as per the above instructions and then copied the client ID and secret over to my PlayFab title's addons/Google settings.
3. In Unity, ensured that Play Games Platform is initialised correctly, requesting profile auth scope:
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
.AddOauthScope("profile")
.RequestServerAuthCode(false)
.Build();
PlayGamesPlatform.InitializeInstance(config);
4. Once authenticated with Google, ensured that the ServerAuthCode is not null or empty (looks to be a valid code):
var serverAuthCode = PlayGamesPlatform.Instance.GetServerAuthCode();
5. Used the code from the PlayFab example to authenticate with PlayFab:
PlayFabClientAPI.LoginWithGoogleAccount(new LoginWithGoogleAccountRequest(){
TitleId = PlayFabSettings.TitleId,
ServerAuthCode = serverAuthCode,
CreateAccount = true}, (result) =>
{
Debug.Log("Signed In as " + result.PlayFabId);
}, OnPlayFabError);
At this stage unfortunately an error is always called:
Error.message = "InvalidGoogleToken"
Error.GenerateErrorReport() = "Google API error code: invalid_client details: Unauthorized"
Any help on this would be greatly appreciated.