Sign In Register

How can we help you today?

Start a new topic
Answered

How to transfer external Ids from one account to another using Cloud Code?

Hi, 


I need to merge one account to another. All the game data is transferred without problems, but I can't move the GP external authentication.


I tried this way but something is not working. 

      if (tokenGP != "null")
      {
                Spark.sendRequest(
                    {
                     "@class": ".GooglePlusConnectRequest",
                     "accessToken": tokenGP,
                     "doNotLinkToCurrentPlayer": false,
                     "errorOnSwitch": false,
                     "switchIfPossible": false,
                     "syncDisplayName": false
                    }
                );
      }

  

Thanks!

Irakli


Best Answer

SOLVED

  

if (tokenGP != "null")
{
	Spark.sendRequest( { "@class" : ".SocialDisconnectRequest", "systemId" : "GP"} );
        Spark.sendRequestAs(
           {
              "@class": ".GooglePlusConnectRequest",
              "accessToken": tokenGP,
              "doNotLinkToCurrentPlayer": false,
              "errorOnSwitch": false,
              "switchIfPossible": false,
              "syncDisplayName": false
           },
           connectResponce.switchSummary.id
        );
}

   


*** CORRECTION ***


I was linking to current connected GameSparks account (too long working day). I need to link to the account to which current account should be merged. I changed to sendRequestAs, but it didn't helped anyway.

 if (tokenGP != "null")
 {
                Spark.sendRequestAs(
                    {
                     "@class": ".GooglePlusConnectRequest",
                     "accessToken": tokenGP,
                     "doNotLinkToCurrentPlayer": false,
                     "errorOnSwitch": false,
                     "switchIfPossible": false,
                     "syncDisplayName": false
                    },
                    connectResponce.switchSummary.id
                );
 }

  

Answer

SOLVED

  

if (tokenGP != "null")
{
	Spark.sendRequest( { "@class" : ".SocialDisconnectRequest", "systemId" : "GP"} );
        Spark.sendRequestAs(
           {
              "@class": ".GooglePlusConnectRequest",
              "accessToken": tokenGP,
              "doNotLinkToCurrentPlayer": false,
              "errorOnSwitch": false,
              "switchIfPossible": false,
              "syncDisplayName": false
           },
           connectResponce.switchSummary.id
        );
}

   

Login to post a comment