I’m having an issue in our game where the Google linking is not working as expected in our account linking workflow and I am unsure as what is going wrong.
We are using the following:
- Unity 2017.1.2p3
- Google Play Game Services Plugin 0.9.41
- PlayFab Unity SDK 2.32.171106
The game currently has this workflow:
1 - Login to PlayFab with the Device ID
2 - Authenticate with Google Play Games platform
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().AddOauthScope("profile").RequestServerAuthCode(false).Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.DebugLogEnabled = true; PlayGamesPlatform.Activate();
3 - If GooglePlay authenticates successful, look up for existing accounts on that platform:
GetPlayFabIDsFromGoogleIDsRequest request = new GetPlayFabIDsFromGoogleIDsRequest() { GoogleIDs = new List<string>() { Social.localUser.id } }; PlayFabClientAPI.GetPlayFabIDsFromGoogleIDs(request, (GetPlayFabIDsFromGoogleIDsResult obj) => { /* evaluate existing links to this ID */ }, (PlayFabError err) => {...});
4 - If no existing link found then prompt the user to link the account and do the following:
GooglePlayGames.PlayGamesPlatform platform = (GooglePlayGames.PlayGamesPlatform)Social.Active; serverAuthCode = platform.GetServerAuthCode(); LinkGoogleAccountRequest request = new LinkGoogleAccountRequest() { ForceLink = true, S erverAuthCode = serverAuthCode }; PlayFabClientAPI.LinkGoogleAccount(request, HandleAccountLinkSuccess, HandleAccountLinkError);
The Problem
PlayFabClientAPI.LinkGoogleAccount() is returning successful but the link doesn't seem right. First we noticed that PlayFabClientAPI.GetPlayFabIDsFromGoogleIDs() would never actually the PlayFab ID of the player that was linked. I looked up the player in the developer console but there is no Google account visible on the Overview page.
I added a PlayFabClientAPI.GetAccountInfo() call to do some debugging and it seems that the Google ID that is associated with the PlayFab account doesn't actually match the value returned by Social.localUser.id.
When I print out all the data I can see
PlayFab ID = 431FFA7AE5DE41BA
GoogleId linked on PlayFab = 108497095532356099240
Social.localUser.id = g09647207943146822087
I have printed out all the Google user data I have access through the GPGS plugin on the client but nothing seems to match the Google ID PlayFab has linked to the player's account. Where is the value 108497095532356099240 coming from? Does anyone know why it would not match the Google ID I am getting on the client?
I'm not sure what I'm exactly doing wrong as the same workflow works great for GameCenter account linking.