Gamebase SDK for Unity  2.2.0
Toast Gamebase Platform

◆ AddMappingForcibly() [1/3]

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

This game interface allows authentication to be made with SDK provided by IdP, before applying Gamebase AddMapping with provided access token.

Since
Added 2.2.0.
Parameters
providerNameThe providerName which is 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(string idPName)
{
Gamebase.AddMapping(idPName, (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(idPName, 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.
}
}
});
}