Gamebase SDK for Unity  2.3.0
Toast Gamebase Platform

◆ AddMappingForcibly() [3/3]

static void AddMappingForcibly ( Dictionary< string, object >  credentialInfo,
string  forcingMappingKey,
GamebaseCallback.GamebaseDelegate< GamebaseResponse.Auth.AuthToken >  callback 
)
static

Forcibly trying to map the currently authenticated user identifier of Gamebase with the credential of external authentication provider.

Since
Added 2.2.0.
Parameters
credentialInfoThe credentialInfo which is credential of authentication provider.
forcingMappingKeyThe key string which is necessary to map forcibly with the provider that is already mappped with another account.
callbackMapping result callback, returns the authentication token as a result of mapping.

Example Usage :

public void AddMappingForcibly(Dictionary<string, object> credential)
{
Gamebase.AddMapping(credential, (authToken, error) =>
{
if (Gamebase.IsSuccess(error) == true)
{
// Add Mapping Success.
}
else
{
// If you got this error code(AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) that means this user already has another account of the AuthProvider.XXX),
// You can call this method, Gamebase.addMappingForcibly() which can try to map forcibly with the AuthProvider.XXX.
if (error.code.Equals(GamebaseErrorCode.AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) == true)
{
// Before calling the mapping forcibly api, You should get this ForcingMappingTicket and ForcingMappingKey string for this method parameter.
GamebaseResponse.Auth.ForcingMappingTicket forcingMappingTicket = GamebaseResponse.Auth.ForcingMappingTicket.MakeForcingMappingTicket(error);
// Try to add mapping forcibly with the ForcingMappingKey.
Gamebase.AddMappingForcibly(credential, forcingMappingTicket.forcingMappingKey, (authTokenForcibly, errorForcibly) =>
{
if (Gamebase.IsSuccess(error) == true)
{
// Add Mapping Forcibly Success.
}
else
{
// Add Mapping Forcibly Failed.
// Check the error code and handle the error appropriately.
}
});
}
else
{
// Add Mapping Failed.
// Check the error code and handle the error appropriately.
}
}
});
}