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

◆ ChangeLogin()

static void ChangeLogin ( GamebaseResponse::Auth::ForcingMappingTicket forcingMappingTicket,
GamebaseCallback::GamebaseDelegate< GamebaseResponse::Auth::AuthToken > callback )
static

Change logged in account with ForcingMappingTicket.

Since
Added 2.30.0.
Parameters
forcingMappingTicketThe mapping information which is necessary to log in another account.
callbackResume mapping result callback, returns the authentication token as a result of mapping.

Example Usage :

public void ChangeLoginSample()
{
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 for this method parameter.
GamebaseResponse.Auth.ForcingMappingTicket forcingMappingTicket = GamebaseResponse.Auth.ForcingMappingTicket.From(error);
if (forcingMappingTicket == null)
{
// Unexpected error occurred. Contact Administrator.
}
// Try to change log in account with the ForcingMappingTicket.
Gamebase.ChangeLogin(forcingMappingTicket, (innerAuthToken, innerError) =>
{
if (Gamebase.IsSuccess(innerError) == true)
{
// Log in account changed successfully.
string userId = innerAuthToken.member.userId;
Debug.Log(string.Format("ChangeLogin succeeded. Gamebase userId is {0}", userId));
}
else
{
// Change login failed.
// The UserID will not changed.
Debug.Log(string.Format("ChangeLogin 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