Gamebase SDK for Unity 2.75.1 Toast Gamebase Platform

Loading...
Searching...
No Matches

## ◆ Login() [2/3]

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

There is information which must be included for login 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

  providerName | The providerName which is authentication provider.
  additionalInfo | The additionalInfo which is additional information using for login. Refer to the following document for the entire additionalInfo. http://docs.toast.com/en/Game/Gamebase/en/oper-app/#authentication-information
  callback | Login result callback, returns the authentication token as a result of login.

Example Usage :

public void LoginWithAdditionalInfoSample()
{
var additionalInfo = new Dictionary<string, object>
{
{ "key", "value" }
};
Gamebase.Login(GamebaseAuthProvider.XXX, additionalInfo, (authToken, error) =>
{
if (Gamebase.IsSuccess(error) == true)
{
if(authToken.member.temporaryWithdrawal != null)
{
long gracePeriodDate = authToken.member.temporaryWithdrawal.gracePeriodDate;
Debug.Log(string.Format("User is under temporary withdrawa. GracePeriodDate : {0}", error));
} <br>
else
{
string userId = authToken.member.userId;
Debug.Log(string.Format("Login succeeded. Gamebase userId is {0}", userId));
}
}
else
{
// Check the error code and handle the error appropriately.
Debug.Log(string.Format("Login failed. error is {0}", error));
if (error.code == GamebaseErrorCode.BANNED_MEMBER)
{
GamebaseResponse.Auth.BanInfo banInfo = GamebaseResponse.Auth.BanInfo.From(error);
if (banInfo != null)
{
}
}
}
});
}