Gamebase SDK for Unity 2.76.0 Toast Gamebase Platform

Loading...
Searching...
No Matches

## ◆ AddMapping() [3/3]

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

Try mapping to another IdP while logged-in to a specific IdP.

If an IdP account to map has already been integrated to another account, return the AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER (3302) error. Even if a mapping is successful, 'currently logged-in IdP' does not change. Mapping simply adds IdP integration.

Since
  Added 1.4.0.

Parameters

  providerName | The providerName which is authentication provider.
  callback | Mapping result callback, returns the authentication token as a result of mapping.

Example Usage :

public void AddMappingSample()
{
Gamebase.AddMapping(GamebaseAuthProvider.XXX, (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 API.
}
else
{
// Check the error code and handle the error appropriately.
Debug.Log(string.Format("AddMapping failed. error is {0}", error));
}
}
});
}
Toast.Gamebase.Gamebase.AddMapping
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:1068
Toast.Gamebase.Gamebase
The Gamebase class is core of Gamebase service.
Definition Gamebase.cs:11