Gamebase SDK for Unity 2.69.0
Toast Gamebase Platform
Loading...
Searching...
No Matches

◆ AddMappingForcibly() [2/4]

static void AddMappingForcibly ( GamebaseResponse::Auth::ForcingMappingTicket forcingMappingTicket,
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.30.0.
Parameters
forcingMappingTicketThe mapping information 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 AddMappingForciblySample()
{
Gamebase.AddMapping(GamebaseAuthProvider.XXX, (authToken, error) =>
{
if (Gamebase.IsSuccess(error) == true)
{
// AddMapping succeeded.
}
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.From(error);
if (forcingMappingTicket == null)
{
// Unexpected error occurred. Contact Administrator.
}
// Try to add mapping forcibly with the ForcingMappingTicket.
Gamebase.AddMappingForcibly(forcingMappingTicket, (innerAuthToken, innerError) =>
{
if (Gamebase.IsSuccess(innerError) == true)
{
string userId = innerAuthToken.member.userId;
Debug.Log(string.Format("AddMappingForcibly succeeded. Gamebase userId is {0}", userId));
}
else
{
// Check the error code and handle the error appropriately.
Debug.Log(string.Format("AddMappingForcibly failed. error is {0}", innerError));
}
});
}
else
{
// Add Mapping Forcibly Failed.
// Check the error code and handle the error appropriately.
Debug.Log(string.Format("AddMapping failed. error is {0}", error));
}
}
});
}
static void AddMapping(string providerName, GamebaseCallback.GamebaseDelegate< GamebaseResponse.Auth.AuthToken > callback)
Try mapping to another IdP while logged-in to a specific IdP.
Definition Gamebase.cs:1039
The Gamebase class is core of Gamebase service.
Definition Gamebase.cs:11