Gamebase SDK for Unity 2.75.1 Toast Gamebase Platform

Loading...
Searching...
No Matches

## ◆ LoginForLastLoggedInProvider() [2/2]

static void LoginForLastLoggedInProvider | ( | GamebaseCallback::GamebaseDelegate< GamebaseResponse::Auth::AuthToken > | callback | ) |
| static

Try login with the most recently logged-in IdP.

If a token is expired or its authentication fails, return failure. Note that a login for the IdP should be implemented.

Since
  Added 1.4.0.

Parameters

  callback | Login result callback, returns the authentication token as a result of login.

Example Usage :

public void LoginForLastLoggedInProviderSample()
{
Gamebase.LoginForLastLoggedInProvider((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("LoginForLastLoggedInProvider succeeded. Gamebase userId is {0}", userId));
}
}
else
{
if (error.code == GamebaseErrorCode.SOCKET_ERROR || error.code == GamebaseErrorCode.SOCKET_RESPONSE_TIMEOUT)
{
Debug.Log(string.Format("Retry LoginForLastLoggedInProvider or notify an error message to the user. : {0}", error.message));
}
else
{
if (string.IsNullOrEmpty(Gamebase.GetLastLoggedInProvider()) == true)
{
// Display the IdP select menu to user.
}
else
{
Gamebase.Login(Gamebase.GetLastLoggedInProvider(), (innerAuthToken, innerError) =>
{
if (Gamebase.IsSuccess(innerError) == true)
{
string userId = innerAuthToken.member.userId;
Debug.Log(string.Format("LoginForLastLoggedInProvider succeeded. Gamebase userId is {0}", userId));
}
else
{
// Check the error code and handle the error appropriately.
Debug.Log(string.Format("LoginForLastLoggedInProvider failed. error is {0}", innerError));
}
});
}
}
}
});
}
Toast.Gamebase.Gamebase.LoginForLastLoggedInProvider
static void LoginForLastLoggedInProvider(GamebaseCallback.GamebaseDelegate< GamebaseResponse.Auth.AuthToken > callback)
Try login with the most recently logged-in IdP.
Definition: Gamebase.cs:822
Toast.Gamebase.Gamebase.IsSuccess
static bool IsSuccess(GamebaseError error)
Return true if the GamebaseException object is null or the error code is zero.
Definition: Gamebase.cs:57
Toast.Gamebase.Gamebase
The Gamebase class is core of Gamebase service.
Definition: Gamebase.cs:11