Gamebase SDK for Unity 2.75.1 Toast Gamebase Platform

Loading...
Searching...
No Matches

## ◆ Login() [1/3]

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

This game interface allows authentication to be made with SDK provided by IdP, before login to Gamebase with provided access token.

Since
  Added 1.4.0.

Parameters

  credentialInfo | The credentialInfo which is credential of authentication provider. Refer to the following document for the entire credentialInfo. http://docs.toast.com/en/Game/Gamebase/en/unity-authentication/#login-with-credential
  callback | Login result callback, returns the authentication token as a result of login.

Example Usage :

public void LoginWithCredentialInfoSample()
{
var credentialInfo = new Dictionary<string, object>
{
{ GamebaseAuthProviderCredential.PROVIDER_NAME, GamebaseAuthProvider.XXX },
{ GamebaseAuthProviderCredential.ACCESS_TOKEN, "${AccessToken}" }
};
Gamebase.Login(credentialInfo, (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)
{
}
}
}
});
}