Sign In Register

How can we help you today?

Start a new topic
Answered

Switching an account from Game Center to Facebook

Hi,


in our game, people can login via facebook or game center. It tries to authenticate with Game Center by default (if the user is logged into game center already). But it seems like if the user got authenticated by game center first, and then tries to connect to facebook instead, gamesparks creates a new profile for that user. 


If the user doesn't connect to game center first and then uses facebook, it merges properly (keeps all his progress). 


Is there a way to keep all the data/progress from the game center account when switching over to facebook, or would i have to manually copy everything into the new account? 


Thanks,

Sven


Best Answer

Hi Andreas,


You're causing the issue by deleting the players manually here. When you authenticate socially a document is created for that player in the externalAuthentication system collection which gets associated with the player. By deleting the player manually that document is linked to a player that doesn't exist so when it tries to link back (in a social connect request) it has to create a new player as the old linked one doesn't exist. I'd recommend deleting your players with the SparkPlayer deletePlayer call. This will remove them from all other system collections (including the externalAuthentication one) and should prevent you seeing this in the future.


Regards,

Liam


1 person has this question

Hi Sven, 


When a player is authenticated and then tries to link another social account, keeping doNotLinkToCurrentPlayer set to false should associate the social profiles with the current authenticated account. Can you let me know how you are sending the FacebookConnectRequests from your game ?


Thanks,

Liam

I have the same issue. The game authenticates with Game Center first since (in my test case) the user is already signed in. If the user then connects to Facebook and I send a FacebookConnectRequest a new player on GameSparks is created regardless of sending True or False in the doNotLinkToCurrentPlayer field.


Here is the request log: 

{"requestId":"1509070562.358449","accessToken":"EAAQoILt9X4EBAIZC1mPvfufpPRL9Qehg275SrZB9g6wFLAvA1zpxgFYA9tfn8uvQyk4n98vJ34yZAb7brac9W0m0tADmL0dHow0iXGZBPxjp89jRQg1t5nM2ZCW3y5KbekCG8YpwpMDyjeAI26nWE1yZAvnNz7a3vb7ZAULh0JgN8fDw76ldPGcaoi325KSlnYYObi5Der41mAarDE8BKBCk26Tdd7XWMlcK9ZCwHKS3e21v6nJyJ2MK","syncDisplayName":false,"doNotLinkToCurrentPlayer":false,"@class":".FacebookConnectRequest"}


Here is the response log:

{"@class":".AuthenticationResponse","authToken":"7a6fe048-c79f-47f3-8da5-4b36e46075d9","displayName":"Andreas Eriksson","newPlayer":true,"requestId":"1509070562.358449","userId":"59f296e274860504e32bfde8"}


A new player was created even though I was already authenticated with Game Center.

Answer

Hi Andreas,


You're causing the issue by deleting the players manually here. When you authenticate socially a document is created for that player in the externalAuthentication system collection which gets associated with the player. By deleting the player manually that document is linked to a player that doesn't exist so when it tries to link back (in a social connect request) it has to create a new player as the old linked one doesn't exist. I'd recommend deleting your players with the SparkPlayer deletePlayer call. This will remove them from all other system collections (including the externalAuthentication one) and should prevent you seeing this in the future.


Regards,

Liam

Thanks Liam, you are right of course :)


I have verified that after cleaning up orphan records, it does link FB and GC to the same player record.



Login to post a comment