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

◆ AddMapping() [2/3]

static void AddMapping ( string providerName,
Dictionary< string, object > additionalInfo,
GamebaseCallback::GamebaseDelegate< GamebaseResponse::Auth::AuthToken > callback )
static

There is information which must be included for mapping with some IdPs.

In order to set such necessary information, this API is provided. You can enter those information to additionalInfo in the dictionary type.

Since
Added 1.4.0.
Parameters
providerNameThe providerName which is authentication provider.
additionalInfoThe additionalInfo which is additional information using for mapping. Refer to the following document for the entire additionalInfo. http://docs.toast.com/en/Game/Gamebase/en/oper-app/#authentication-information
callbackCallbacks the results of mappings, returns the authentication token as a result of mappings.

Example Usage :

public void AddMappingWithAdditionalInfoSample()
{
var additionalInfo = new Dictionary<string, object>
{
{ "key", "value" }
};
Gamebase.AddMapping(GamebaseAuthProvider.XXX, additionalInfo, (authToken, error) =>
{
if (Gamebase.IsSuccess(error) == true)
{
string userId = authToken.member.userId;
Debug.Log(string.Format("AddMapping succeeded. Gamebase userId is {0}", userId));
}
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)
{
// See AddMappingForcibly with additionalInfo API.
}
else
{
// Check the error code and handle the error appropriately.
Debug.Log(string.Format("AddMapping failed. error is {0}", error));
}
}
});
}