question

Kim Strasser avatar image
Kim Strasser asked

How can I find out if an account is anonymous or recoverable?

Is it possible to find out if the account is anonymous or recoverable after I used LoginWithIOSDeviceID or LoginWithAndroidDeviceID to log in to that account?

Account Management
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Seth Du avatar image
Seth Du answered

If you want to access linked accounts information, you may call client API GetPlayerProfile meanwhile add profile constraints in the request like:

{
  "ProfileConstraints": {
  	"ShowLinkedAccounts":true
  }
}

However, you need to make sure the option "Linked accounts" in "ALLOW CLIENT ACCESS TO SENSITIVE PROFILE PROPERTIES" is checked in [Game manager] -> [title settings] -> [Client Profile Options].

However, since it is sensitive information, we'd suggest not to check it. You may implement corresponding server API in cloud Script.

7 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kim Strasser avatar image Kim Strasser commented ·

Is it possible to get the linked accounts information with the API GetPlayerProfile in CloudScript or how can I get this information in CloudScript? I want to show a message in my game if the account is anonymous or recoverable.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Kim Strasser commented ·

Yes, you may implement server API GetPlayerProfile in Cloud Script. Moreover, you may keep the verification process in Cloud Script and only return Boolean variable.

0 Likes 0 ·
Kim Strasser avatar image Kim Strasser Seth Du ♦ commented ·

I get a JavascriptException in my CloudScript. How can I check if the player's account is recoverable?

"StackTrace": "ReferenceError: IsAccountRecoverable is not defined\n    at handlers.IsAccountRecoverable (BFD0A-main.js:751:38)\n    at Object.invokeFunction (Script:116:33)"
handlers.IsAccountRecoverable = function (args, context)
{
   var CurrentAccount = "";
   var resultprofile = server.GetPlayerProfile(
       {
           PlayFabID: currentPlayerId, 
           ProfileConstraints : {
               ShowLinkedAccounts: true
               
           }
       });
       
   if (resultprofile.Error == null)
   {
      if (resultprofile.PlayerProfile != null)
      {
        CurrentAccount = resultprofile.PlayerProfile.LinkedAccounts;
        if (CurrentAccount != null)
        {
           if (CurrentAccount == IsAccountRecoverable)
           {
             log.info("Your account is recoverable.");
       	     return "true";
           }
       	   else
       	   {
       	     log.info("Your account is not recoverable.");
       	     return "false";
       	   }
        }
        else
           log.info("Not possible to get account information.");
      }
    }
}
0 Likes 0 ·
Show more comments
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.