Combu  2.1.14
Unity API Documentation
Linking external platforms

Table of Contents

In this section you will learn how to authenticate and link the local user to an external platform like GameCenter, Facebook etc.

Authentication

To authenticate the local user with a platform Id you need to call CombuManager.localUser.AuthenticatePlatform. If the platform key+id exists then it will return the registered account, else it will create a new account with username PlatformName_PlatformId (including the underscore symbol).

// After you have logged in with Facebook SDK (http://u3d.as/5j1)
CombuManager.localUser.AuthenticatePlatform("Facebook", FB.UserId, (bool success, string error) => {
if (success)
Debug.Log("Login success: ID " + CombuManager.localUser.id);
else
Debug.Log("Login failed: " + error);
});

Link a platform to the local user

If the local user is already logged, you can link a platform Id to the account with CombuManager.localUser.LinkPlatform:

CombuManager.localUser.LinkPlatform("YourPlatformName", "YourPlatformId", (bool success, string error) => {
if (success)
Debug.Log("Link success");
else
Debug.Log("Link failed: " + error);
});

Transfer the external platforms

Sometimes may happen that you need to move the external platforms of the local user to another account, in this case you can use CombuManager.localUser.LinkAccount (the platforms key+id of the local user account will be transferred to the new account, the account and all its data/scores/etc deleted, and the new account will be assigned to the local user):

CombuManager.localUser.LinkAccount("other_username", "other_password", (bool success, string error) => {
if (success)
Debug.Log("Transfer success");
else
Debug.Log("Transfer failed: " + error);
});