RemapGoogleId() during AuthenticateGoogle() is not working for us after changing authentication from GPS V1 to GPS V2

We moved from depracated Google Play Services V1 to new version in our game. We had to change how our game is authenticating with Google Play Services: before the change, we used TokenID, now we use ServerAuthCode.

In order to authenticate from our game to Nakama, we had to add new google credentials flag to nakama configuration:

{"web":"client_id":"","project_id":"","auth_uri":"","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"","redirect_uris":[""]}}'

We are using latest nakama version 3.26.

Now we encountered an issue, where user is getting new nakama account with new Google ID linked, despite logging from the same google account.

Old Google ID have different format: 113792687972591949640
New Google ID have a prefix: a_6368656850866412253

I found that there is a function for remapping old google Ids to new one:

But unfortunately, it’s not working for us. Can you please provide a solution to successfully remap old accounts to new ids or can you point me resources, which can shed new light on this issue?

Regards,
Michał

@MichalKrela the remapping looks at the originalPlayerId field to map the old id to the new one.

I believe this value may not always be available, but it is not clear to me when it is or isn’t depending on the Google auth scopes, flow, account details and etc.

Is the case that the value is coming back empty?

Hi @sesposito
thanks for answer. In our case, as you can see below, originalPlayerId is not populated in response json (don’t mind id is different from previous post, I checked this behavior on number of accounts):

{
    "kind": "games#player",
    "playerId": "a_3547597106375657482",
    "displayName": "SeemingDetention84",
    "avatarImageUrl": "https://lh3.googleusercontent.com/n2E1SEZhkLSgYX0vzRtXvUrc5D4DtNZKj4EFMX_Bk_-yY5Da9HKb4L2iG7tjajZY8RVr",
    "bannerUrlPortrait": "https://lh3.googleusercontent.com/iXNdw4kqPIpEFFF45s8f6rJUYW9J0-OxUI9VVP2dRlY06Kj99Qy0Qi0yGuq_IlGDGMqyZK5g3FlmD-GYqA",
    "bannerUrlLandscape": "https://lh3.googleusercontent.com/I2yadG1Gyqpk2rQNtW3GfJNNKjHXBuYLULmTPdvcvx6325gNhSo-B3jcpBRzBseeHKZnyf1EaG8aeHXd6yE",
    "profileSettings": {
        "kind": "games#profileSettings",
        "profileVisible": true,
        "friendsListVisibility": "REQUEST_REQUIRED"
    },
    "experienceInfo": {
        "kind": "games#playerExperienceInfo",
        "currentExperiencePoints": "0",
        "currentLevel": {
            "kind": "games#playerLevel",
            "level": 1,
            "minExperiencePoints": "0",
            "maxExperiencePoints": "1000"
        },
        "nextLevel": {
            "kind": "games#playerLevel",
            "level": 2,
            "minExperiencePoints": "1000",
            "maxExperiencePoints": "2500"
        }
    },
    "title": "Rookie",
    "gamePlayerId": "a_3547597106375657482"
}

Can you suggest any other workaround on this issue, other than remapping IDs?

Regards,
Michał

I found this: Next generation Player IDs  |  Android game development  |  Android Developers.

Next generation Player IDs will only apply to users who have never signed into your game with PGS. Existing users who have already logged into your game will continue to get the same Player ID.

My understanding is that accounts that have signed in and were assigned the old ID, should still observe it now, is that not the case?

On the Player payload spec:

originalPlayerId:

The player ID that was used for this player the first time they signed into the game in question. This is only populated for calls to player.get for the requesting player, only if the player ID has subsequently changed, and only to clients that support remapping player IDs.

If the originalPlayerId is not returned, I’m not sure how else to map an existing account on the old ID to the new one.