Sign In Register

How can we help you today?

Start a new topic
Answered

DeviceAuthenticationRequest and FacebookConnectRequest issue

Hello folks!


Can you explain the right way to merge users account using DeviceAuthenticationRequest and FacebookConnectRequest?


The steps are:


1. System.player collection is clear.

2. Player starts the game on iPhone. Here we call DeviceAuthenticationRequest, got the response and first record appears in the system.player, for example:


{"_id":{"$oid":"58b395760a162ad63e8b0018"},"userName":"305009-IOS-3BA03634-484B-46D6-9209-98639E0F479F",


3. User plays  3 or 4 levels, saving his progress on the backend and closes the application

4. Next time he logins, gets his progress and continues playing.  There is no issues here.

5. But If i try to connect to Facebook using 

           new FacebookConnectRequest ().SetAccessToken(aToken.TokenString).SetDoNotLinkToCurrentPlayer (false).Send() ...


second record appears in system.player

{"_id":{"$oid":"58b395760a162ad63e8b0018"},"userName":"305009-IOS-3BA03634-484B-46D6-9209-98639E0F479F",

{"_id":{"$oid":"58b396309a8e0504c9f12b09"},"gameId":{"$numberLong":"305009"},"deviceRegIds":{},


we can see here  oid has changed and as a result, current player’s progress not found in the progress collection ( Cloud Code’s event  uses Spark.getPlayer().getPlayerId() to store and get progress )


What do we wrong?


P.S. There is no further issues to store  and get back user's progress with linked FB account. 

The issue only happens in very first moment of «trying to link fb to device» 


Best Answer

Hi Andrey,


Apologies for the delayed response. By default the FacebookConnectRequest should link to the currently authenticated player as long as .SetDoNotLinkToCurrentPlayer is not set to true. When this is set to true a new player will be created. Has the Facebook account been linked to another player in the system ? What is the name of your game ? I'd like to take a look at the players who you have mentioned above.


Regards,

Liam


Answer

Hi Andrey,


Apologies for the delayed response. By default the FacebookConnectRequest should link to the currently authenticated player as long as .SetDoNotLinkToCurrentPlayer is not set to true. When this is set to true a new player will be created. Has the Facebook account been linked to another player in the system ? What is the name of your game ? I'd like to take a look at the players who you have mentioned above.


Regards,

Liam

Hello Liam,


I am currently facing the same issue, I had a previous user created, and then I tried to implement the device authentication, and it created a new player. In your answer, you mentioned this: "Has the Facebook account been linked to another player in the system ?". Will it not function if the user was created previously? and does it make any difference if the game was built on an actual device or not as I am currently just testing on my Unity editor?


Thanks.

Login to post a comment