Skip to main content
Version: 5.15.0

AuthorizeFederation

public BackendReturnObject AuthorizeFederation(string federationToken, FederationType type);
public BackendReturnObject AuthorizeFederation(string federationToken, FederationType type, string ect);

Parameters

ValueTypeDescription
federationTokenstringFederation token
typeFederationType(enum)Types of federations
FederationType.Google
FederationType.Facebook
FederationType.Apple
FederationType.Steam
FederationType.GPGS2
etcstring(Optional) The piece of information desired to be saved from the additional

Description

An attempt is made to sign up or log in using the member information token value of Google/Apple/Facebook.

  • If the user has no history of signing up with the token, a login is attempted at the same time as the sign-up.
  • If the user has a history of signing up with the token, a login is attempted.

Example

Synchronous

Backend.BMember.AuthorizeFederation(
"federationToken",
FederationType.Google,
"Signed up with GPGS"
);

Asynchronous

Backend.BMember.AuthorizeFederation(
"federationToken",
FederationType.Google,
"Signed up with GPGS",
(callback) => {
// Process after federation authentication
}
);

SendQueue

SendQueue.Enqueue(
Backend.BMember.AuthorizeFederation,
"federationToken",
FederationType.Google,
"Signed up with GPGS",
(callback) => {
// Process after federation authentication
}
);

ReturnCase

Success cases

When login is successful
statusCode : 200
message : Success

When signing up as a new member is successful
statusCode : 201
message : Success

Error cases

When the device information is 'null'
statusCode : 400
errorCode : UndefinedParameterException
message : undefined device_unique_id, device_unique_id cannot be checked

When the user is blocked
statusCode : 403
errorCode : The reason for blocking entered in the console
message : Forbidden blocked user, Blocked user
code : 403100
errorMessage : 757fe1d0-03af-11ef-bda5-fd24a5f141c1 blocked until 2024-11-29T12:41:19.465Z
errorData : {
uuid : 757fe1d0-03af-11ef-bda5-fd24a5f141c1
nickname : Nickname
blockReason : The reason for blocking entered in the console
blockDate : 2024-11-29T12:41:19.465Z
}

If the user is blocked, you can check the following error data.

  • Code : Unique ID for the error case
  • ErrorMessage : Details of that error
  • ErrorData : Detailed data related to the error (If nickname and blockReason do not exist, data cannot be parsed.)

Error use example

var callback = Backend.BMember.CustomLogin("a0", "a0");

Debug.Log(
if (callback.GetMessage().StartsWith("Forbidden blocked user"))
{
StringBuilder returnString = new StringBuilder();
returnString.Append("StatusCode : ").Append(callback.GetStatusCode()).AppendLine();
returnString.Append("ErrorCode : ").Append(callback.GetErrorCode()).AppendLine();
returnString.Append("Message : ").Append(callback.GetMessage()).AppendLine();

returnString.Append("Code : ").Append(callback.GetCode()).AppendLine();
returnString.Append("ErrorMessage : ").Append(callback.GetErrorMessage()).AppendLine();

returnString.Append("errorData(uuid) : ").Append(callback.GetErrorData()["uuid"].ToString()).AppendLine();

if (callback.GetErrorData().ContainsKey("nickname"))
{
returnString.Append("errorData(nickname) : ").Append(callback.GetErrorData()?["nickname"].ToString()).AppendLine();
}

if (callback.GetErrorData().ContainsKey("blockReason"))
{
returnString.Append("errorData(blockReason) : ").Append(callback.GetErrorData()?["blockReason"].ToString()).AppendLine();
}

returnString.Append("errorData(blockDate) : ").Append(callback.GetErrorData()["blockDate"].ToString()).AppendLine();

Debug.Log(returnString.ToString());
}
)

When the device is blocked
statusCode : 403
errorCode : ForbiddenException
message : Forbidden blocked device, Blocked device
code : 403100
errorMessage : 20240426092307fc5ac478c is blocked
errorData : {
deviceUniqueId : 20240426092307fc5ac478c
}

If the device is blocked, you can check the following error data.

  • Code : unique ID for the error case
  • ErrorMessage : Details of that error
  • ErrorData : Detailed data related to the error

Error use example

var callback = Backend.BMember.CustomSignUp("a0", "a0");

Debug.Log(
if (callback.IsDeviceBlockError())
{
StringBuilder returnString = new StringBuilder();
returnString.Append("StatusCode : ").Append(callback.GetStatusCode()).AppendLine();
returnString.Append("ErrorCode : ").Append(callback.GetErrorCode()).AppendLine();
returnString.Append("Message : ").Append(callback.GetMessage()).AppendLine();
returnString.Append("Code : ").Append(callback.GetCode()).AppendLine();
returnString.Append("ErrorMessage : ").Append(callback.GetErrorMessage()).AppendLine();
returnString.Append("errorData(deviceUniqueId)").Append(callback.GetErrorData()["deviceUniqueId"].ToString()).AppendLine();
Debug.Log(returnString.ToString());
}
)

When withdrawal is in progress (after calling the WithdrawAccount method)
statusCode : 410
errorCode : GoneResourceException
message : Gone user, This user does not exist

When the withdrawal is completed, the new sign-up takes place as 201.


Federation account logout

If you want to log out from the currently logged-in federation account and switch to another federation user,

you must log out from the BACKND account and then log out from the federation account to properly log in to another federation account.
After logging in to another federation account, you must call the AuthorizeFederation method to the BACKND account again to successfully play a game with the new account.

How to log out from GPGS

public void GoogleSignout(){
GoogleSignIn.DefaultInstance.SignOut();
}

How to log out from Facebook

public void FacebookLogOut(){
FB.LogOut();
}