API Reference of GS2-Account SDK for Game Engine
Model
EzAccount
Game Player Account
An entity of identity information that identifies a game player. Game player accounts are anonymous accounts and consist of a user ID (UUID) and password (a random 32-character string), so game players do not need to enter their email address or other information.
The issued game player account is stored in the device’s local storage and is used for future logins.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | UUID | ~ 128 chars | User Id | |
| password | string | ✓ | ~ 128 chars | Password Stores the password for securing the account. Passwords can be up to 128 characters long and play an important role in protecting your account. | ||
| createdAt | long | ✓ | Now | Datetime of creation Unix time, milliseconds Automatically configured on the server |
EzTakeOver
Takeover Setting
Takeover Setting is information used when changing device models or moving/sharing accounts between platforms. It consists of a unique string of characters that identifies an individual and a password, the appropriate combination of which can be entered to obtain an Account (anonymous account).
Multiple takeover setting can be set up for one Account. To set up multiple handover information, you must specify different slots for each. The number of slots can be from 0 to 1024, which means that a maximum of 1025 different takeover setting can be set.
For example, 0 can be used to store Twitter account information, 1 to store Sign in with Apple account information, and 2 to store Google account information. The following usage is assumed. This takeover setting is only a data holder, and the authentication mechanism with social accounts needs to be prepared separately.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User Id | ||
| type | int | ✓ | 0 ~ 1024 | Slot Number Specified in the range of 0 to 1024 to distinguish different takeover information. | ||
| userIdentifier | string | ✓ | ~ 1024 chars | User ID for takeover A unique key used to identify an individual when taking over an account. If the same userIdentifier is specified for different accounts, the value set later will take precedence. | ||
| createdAt | long | ✓ | Now | Datetime of creation Unix time, milliseconds Automatically configured on the server |
EzPlatformId
Platform ID
Holds IDs for various platforms such as X, Instagram, and Facebook. Other players can search for players using various platform IDs.
When importing Instagram followers or Facebook friends as in-game friends, it is used to identify the GS2-Account account.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| type | int | ✓ | 0 ~ 1024 | Slot Number | ||
| userIdentifier | string | ✓ | ~ 1024 chars | User ID on various platforms | ||
| userId | string | ✓ | ~ 128 chars | User Id | ||
| createdAt | long | ✓ | Now | Datetime of creation Unix time, milliseconds Automatically configured on the server |
EzPlatformUser
Platform user information
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| type | int | ✓ | 0 ~ 1024 | Slot Number | ||
| userIdentifier | string | ✓ | ~ 1024 chars | User ID on various platforms | ||
| userId | string | ✓ | ~ 128 chars | User Id |
EzBanStatus
Account BAN information
Represents information about the BAN (access restriction) status applied to a game player account. This type includes detailed information such as the reason for the BAN, the name of the BAN, and the scheduled date and time for the BAN to be lifted. BAN status can be applied to an account for various reasons, such as cheating or violation of the terms of service, and this type helps to manage that status. The system uses this information to control the account’s access permissions and to restrict or release access as necessary.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| name | string | ✓ | UUID | ~ 36 chars | BAN status name Maintains a unique name for each BAN status. The name is automatically generated in UUID (Universally Unique Identifier) format and is used to identify each BAN status. This ID allows for easy tracking of multiple BAN statuses. | |
| reason | string | ✓ | ~ 256 chars | Reason for BAN Explains the specific reason for the BAN. It can be up to 256 characters long and helps to clarify the cause of the BAN. This information is not only referenced by the account administrator and the operations team, but also included in the response value to the game client. | ||
| releaseTimestamp | long | ✓ | Date and time when the BAN will be released Indicates the date and time when the account BAN will be released. Once this date and time has passed, the account will be automatically released from the BAN and normal access will be possible. |
Methods
authentication
Account Authentication
Authenticate game players using the user ID and password issued by the create function.
When the authentication is completed, account authentication information and signature are issued.
By passing the account credentials and signature to GS2-Auth::Login, you can get an access token to access GS2 services.
GS2-Profile::Login is a combination of this API and GS2-Auth::Login, which is explained in How to start => Sample Programs.
The account credentials and signature have an expiration time of 1 hour.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| userId | string | ✓ | ~ 128 chars | User Id | ||
| keyId | string | ✓ | “grn:gs2:{region}:{ownerId}:key:default:key:default” | ~ 1024 chars | encryption key GRN | |
| password | string | ✓ | ~ 128 chars | Password Stores the password for securing the account. Passwords can be up to 128 characters long and play an important role in protecting your account. |
Result
| Type | Description | |
|---|---|---|
| item | EzAccount | Game Player Account |
| banStatuses | List<EzBanStatus> | Ban status list |
| body | string | Account information for signing subject |
| signature | string | signature |
Error
Special exceptions are defined in this API. GS2-SDK for GameEngine provides specialized exceptions derived from general exceptions to facilitate handling of errors that may need to be handled in games. Please refer to the documentation here for more information on common error types and handling methods.
| Type | Base Type | Description |
|---|---|---|
| PasswordIncorrectException | UnauthorizedException | Incorrect password specified. |
| BannedInfinityException | UnauthorizedException | Account has been suspended. |
Implementation Example
try {
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Account(
userId: "user-0001"
);
var result = await domain.AuthenticationAsync(
password: "password-0001",
keyId: "grn:gs2:ap-northeast-1:owner_id:key:namespace-0001:key:key-0001"
);
var item = await result.ModelAsync();
var banStatuses = result.BanStatuses;
var body = result.Body;
var signature = result.Signature;
} catch(Gs2.Gs2Account.Exception.PasswordIncorrect e) {
// Incorrect password specified.
} catch(Gs2.Gs2Account.Exception.BannedInfinity e) {
// Account has been suspended.
} var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Account(
userId: "user-0001"
);
var future = domain.AuthenticationFuture(
password: "password-0001",
keyId: "grn:gs2:ap-northeast-1:owner_id:key:namespace-0001:key:key-0001"
);
yield return future;
if (future.Error != null)
{
if (future.Error is Gs2.Gs2Account.Exception.PasswordIncorrectException)
{
// Incorrect password specified.
}
if (future.Error is Gs2.Gs2Account.Exception.BannedInfinityException)
{
// Account has been suspended.
}
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.ModelFuture();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result;
var banStatuses = future.Result.BanStatuses;
var body = future.Result.Body;
var signature = future.Result.Signature; const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Account(
"user-0001" // userId
);
const auto Future = Domain->Authentication(
"password-0001", // password
"grn:gs2:ap-northeast-1:owner_id:key:namespace-0001:key:key-0001" // keyId
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
auto e = Future->GetTask().Error();
if (e->IsChildOf(Gs2::Account::Error::FPasswordIncorrectError::Class))
{
// Incorrect password specified.
}
if (e->IsChildOf(Gs2::Account::Error::FBannedInfinityError::Class))
{
// Account has been suspended.
}
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();
const auto BanStatuses = Result->BanStatuses;
const auto Body = Result->Body;
const auto Signature = Result->Signature;create
Create a new account that identifies the game player
Successful execution of this API will return information about the account created. Of the account information returned, make the user ID and password persistent for use in the authentication process.
The password issued here is a random value and cannot be an arbitrary value for the game player.
You can register an identifier that is easy for the game player to understand as a takeover setting.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. |
Result
| Type | Description | |
|---|---|---|
| item | EzAccount | Game player account created |
Implementation Example
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
);
var result = await domain.CreateAsync(
);
var item = await result.ModelAsync(); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
);
var future = domain.CreateFuture(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.ModelFuture();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result; const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
);
const auto Future = Domain->Create(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();addTakeOverSetting
Add Takeover Settings
The Takeover Settings allow you to takeover your account when you change your phone model, etc.
The Takeover Settings can be executed with the combination of a Takeover User ID and a Takeover Password.
Multiple Takeover Settings can be held for a single account by specifying different values for the Slot Number.
For example, you could store the email address/password in Slot number:0 and the social media ID information in Slot number:1, and then use the Slot number:2 to store the social media ID information.
Game players can choose their preferred means of takeover. The game player can choose his or her preferred takeover method.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| type | int | ✓ | 0 ~ 1024 | Slot Number Specified in the range of 0 to 1024 to distinguish different takeover information. | ||
| userIdentifier | string | ✓ | ~ 1024 chars | User ID for takeover A unique key used to identify an individual when taking over an account. If the same userIdentifier is specified for different accounts, the value set later will take precedence. | ||
| password | string | ✓ | ~ 128 chars | Password For security reasons, this password is treated as confidential information and only the hash value is stored. |
Result
| Type | Description | |
|---|---|---|
| item | EzTakeOver | Takeover settings created |
Implementation Example
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).TakeOver(
type: 0,
userIdentifier: "user-0001@gs2.io"
);
var result = await domain.AddTakeOverSettingAsync(
password: "password-0001"
);
var item = await result.ModelAsync(); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).TakeOver(
type: 0,
userIdentifier: "user-0001@gs2.io"
);
var future = domain.AddTakeOverSettingFuture(
password: "password-0001"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.ModelFuture();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result; const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->TakeOver(
0, // type
"user-0001@gs2.io" // userIdentifier
);
const auto Future = Domain->AddTakeOverSetting(
"password-0001" // password
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();addTakeOverSettingOpenIdConnect
Add Takeover Settings using OpenID Connect authentication results
The Takeover Settings allow you to takeover your account when you change your phone model, etc.
The Takeover Settings can be executed with the combination of a Takeover User ID and a Takeover Password.
When using this feature, you do not need to set a password.
To use this feature, you need to specify in advance which authentication service the Slot Number will use.
Also, if the OpenID Connect integration settings are made in the master data, you will not be able to set the takeover settings using the combination of Takeover User ID and Takeover Password for that slot.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| type | int | ✓ | 0 ~ 1024 | Slot Number Specified in the range of 0 to 1024 to distinguish different takeover information. | ||
| idToken | string | ✓ | ~ 10240 chars | OpenID Connect ID Token |
Result
| Type | Description | |
|---|---|---|
| item | EzTakeOver | Takeover settings created |
Implementation Example
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).TakeOver(
type: null,
userIdentifier: null
);
var result = await domain.AddTakeOverSettingOpenIdConnectAsync(
idToken: "0123456789"
);
var item = await result.ModelAsync(); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).TakeOver(
type: null,
userIdentifier: null
);
var future = domain.AddTakeOverSettingOpenIdConnectFuture(
idToken: "0123456789"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.ModelFuture();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result; const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->TakeOver(
nullptr, // type
nullptr // userIdentifier
);
const auto Future = Domain->AddTakeOverSettingOpenIdConnect(
"0123456789" // idToken
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();deleteTakeOverSetting
Delete `Takeover Settings
Deletes the takeover settings that have been set.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| type | int | ✓ | 0 ~ 1024 | Slot Number Specified in the range of 0 to 1024 to distinguish different takeover information. |
Result
| Type | Description | |
|---|---|---|
| item | EzTakeOver | Deleted takeover settings |
Implementation Example
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var result = await domain.DeleteTakeOverSettingAsync(
type: 0
); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var future = domain.DeleteTakeOverSettingFuture(
type: 0
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
} const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
);
const auto Future = Domain->DeleteTakeOverSetting(
0 // type
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
const auto Result = Future->GetTask().Result();doTakeOver
Execute takeover
If the specified user ID for takeover and password for takeover match, the set account information is responded.
Please make the user ID and password from the responded account information permanent and use them.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| type | int | ✓ | 0 ~ 1024 | Slot Number Specified in the range of 0 to 1024 to distinguish different takeover information. | ||
| userIdentifier | string | ✓ | ~ 1024 chars | User ID for takeover A unique key used to identify an individual when taking over an account. If the same userIdentifier is specified for different accounts, the value set later will take precedence. | ||
| password | string | ✓ | ~ 128 chars | Password For security reasons, this password is treated as confidential information and only the hash value is stored. |
Result
| Type | Description | |
|---|---|---|
| item | EzAccount | Game Player Account |
Error
Special exceptions are defined in this API. GS2-SDK for GameEngine provides specialized exceptions derived from general exceptions to facilitate handling of errors that may need to be handled in games. Please refer to the documentation here for more information on common error types and handling methods.
| Type | Base Type | Description |
|---|---|---|
| PasswordIncorrectException | UnauthorizedException | Incorrect password specified. |
Implementation Example
try {
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
);
var result = await domain.DoTakeOverAsync(
type: 0,
userIdentifier: "user-0001@gs2.io",
password: "password-0001"
);
var item = await result.ModelAsync();
} catch(Gs2.Gs2Account.Exception.PasswordIncorrect e) {
// Incorrect password specified.
} var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
);
var future = domain.DoTakeOverFuture(
type: 0,
userIdentifier: "user-0001@gs2.io",
password: "password-0001"
);
yield return future;
if (future.Error != null)
{
if (future.Error is Gs2.Gs2Account.Exception.PasswordIncorrectException)
{
// Incorrect password specified.
}
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.ModelFuture();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result; const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
);
const auto Future = Domain->DoTakeOver(
0, // type
"user-0001@gs2.io", // userIdentifier
"password-0001" // password
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
auto e = Future->GetTask().Error();
if (e->IsChildOf(Gs2::Account::Error::FPasswordIncorrectError::Class))
{
// Incorrect password specified.
}
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();doTakeOverOpenIdConnect
Execute takeover using OpenID Connect authentication results
Responds with the account information associated with the specified OpenID Connect authentication information.
Please make the user ID and password from the responded account information permanent and use them.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| type | int | ✓ | 0 ~ 1024 | Slot Number Specified in the range of 0 to 1024 to distinguish different takeover information. | ||
| idToken | string | ✓ | ~ 10240 chars | OpenID Connect ID Token |
Result
| Type | Description | |
|---|---|---|
| item | EzAccount | Game Player Account |
Implementation Example
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
);
var result = await domain.DoTakeOverOpenIdConnectAsync(
type: ,
idToken: "0123456789"
);
var item = await result.ModelAsync(); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
);
var future = domain.DoTakeOverOpenIdConnectFuture(
type: ,
idToken: "0123456789"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.ModelFuture();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result; const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
);
const auto Future = Domain->DoTakeOverOpenIdConnect(
, // type
"0123456789" // idToken
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();get
Get takeover settings by specifying type
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| type | int | ✓ | 0 ~ 1024 | Slot Number Specified in the range of 0 to 1024 to distinguish different takeover information. |
Result
| Type | Description | |
|---|---|---|
| item | EzTakeOver | takeover settings |
Implementation Example
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).TakeOver(
type: 0,
userIdentifier: "user-0001@gs2.io"
);
var item = await domain.ModelAsync(); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).TakeOver(
type: 0,
userIdentifier: "user-0001@gs2.io"
);
var future = domain.ModelFuture();
yield return future;
var item = future.Result; const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->TakeOver(
0, // type
"user-0001@gs2.io" // userIdentifier
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}Value change event handling
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).TakeOver(
type: 0,
userIdentifier: "user-0001@gs2.io"
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).TakeOver(
type: 0,
userIdentifier: "user-0001@gs2.io"
);
var future = domain.ModelFuture();
yield return future;
var item = future.Result; const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->TakeOver(
0, // type
"user-0001@gs2.io" // userIdentifier
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Account::Model::FTakeOver> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(CallbackId);Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
getAuthorizationUrl
Get the authentication URL of OpenID Connect
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| type | int | ✓ | 0 ~ 1024 | Slot Number Specified in the range of 0 to 1024 to distinguish different takeover information. |
Result
| Type | Description | |
|---|---|---|
| authorizationUrl | string | Authorization URL |
Implementation Example
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Account(
userId: "userId-0001"
);
var result = await domain.GetAuthorizationUrlAsync(
type: 0
);
var authorizationUrl = result.AuthorizationUrl; var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Account(
userId: "userId-0001"
);
var future = domain.GetAuthorizationUrlFuture(
type: 0
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var authorizationUrl = future.Result.AuthorizationUrl; const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Account(
"userId-0001" // userId
);
const auto Future = Domain->GetAuthorizationUrl(
0 // type
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
const auto Result = Future->GetTask().Result();
const auto AuthorizationUrl = Result->AuthorizationUrl;listTakeOverSettings
Get list of Takeover Settings that have been set
You can retrieve list of takeover settings set by the game player.
You cannot get the value of the takeover password that has been set.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
| Type | Description | |
|---|---|---|
| items | List<EzTakeOver> | List of Takeover Setting |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.TakeOversAsync(
).ToListAsync(); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.TakeOvers(
);
List<EzTakeOver> items = new List<EzTakeOver>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
} const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
);
const auto It = Domain->TakeOvers(
);
TArray<Gs2::UE5::Account::Model::FEzTakeOverPtr> Result;
for (auto Item : *It)
{
if (Item.IsError())
{
return false;
}
Result.Add(Item.Current());
}Value change event handling
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
// Start event handling
var callbackId = domain.SubscribeTakeOvers(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeTakeOvers(callbackId); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.TakeOvers(
);
List<EzTakeOver> items = new List<EzTakeOver>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
} const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
);
// Start event handling
const auto CallbackId = Domain->SubscribeTakeOvers(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeTakeOvers(CallbackId);Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
updateTakeOverSetting
Change the password for the `takeover setting
In order to update the password for takeover via this API, you must already know the password for takeover that has been set.
Use this API when you want to achieve secure update of the takeover settings.
When using this API, remember to revoke access to the delete takeover settings API.
No password authorization is required for game players to delete their takeover settings.
By deleting and recreating it, you are effectively changing the takeover password.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| type | int | ✓ | 0 ~ 1024 | Slot Number Specified in the range of 0 to 1024 to distinguish different takeover information. | ||
| oldPassword | string | ✓ | ~ 128 chars | Old Password | ||
| password | string | ✓ | ~ 128 chars | Password For security reasons, this password is treated as confidential information and only the hash value is stored. |
Result
| Type | Description | |
|---|---|---|
| item | EzTakeOver | Takeover settings |
Error
Special exceptions are defined in this API. GS2-SDK for GameEngine provides specialized exceptions derived from general exceptions to facilitate handling of errors that may need to be handled in games. Please refer to the documentation here for more information on common error types and handling methods.
| Type | Base Type | Description |
|---|---|---|
| PasswordIncorrectException | UnauthorizedException | Incorrect password specified. |
Implementation Example
try {
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).TakeOver(
type: 0,
userIdentifier: "user-0001@gs2.io"
);
var result = await domain.UpdateTakeOverSettingAsync(
oldPassword: "password-0001",
password: "password-1001"
);
var item = await result.ModelAsync();
} catch(Gs2.Gs2Account.Exception.PasswordIncorrect e) {
// Incorrect password specified.
} var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).TakeOver(
type: 0,
userIdentifier: "user-0001@gs2.io"
);
var future = domain.UpdateTakeOverSettingFuture(
oldPassword: "password-0001",
password: "password-1001"
);
yield return future;
if (future.Error != null)
{
if (future.Error is Gs2.Gs2Account.Exception.PasswordIncorrectException)
{
// Incorrect password specified.
}
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.ModelFuture();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result; const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->TakeOver(
0, // type
"user-0001@gs2.io" // userIdentifier
);
const auto Future = Domain->UpdateTakeOverSetting(
"password-0001", // oldPassword
"password-1001" // password
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
auto e = Future->GetTask().Error();
if (e->IsChildOf(Gs2::Account::Error::FPasswordIncorrectError::Class))
{
// Incorrect password specified.
}
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();addPlatformIdSetting
Add Platform ID
The Platform ID is information used to hold IDs for various platforms such as X, Instagram, and Facebook. The type is specified in the range from 0 to 1024 and is used to identify the type of platform. The user identifier specifies the user ID on each platform.
Other players can search for players by specifying the type and user identifier.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| type | int | ✓ | 0 ~ 1024 | Slot Number | ||
| userIdentifier | string | ✓ | ~ 1024 chars | User ID on various platforms |
Result
| Type | Description | |
|---|---|---|
| item | EzPlatformId | Platform Id settings created |
Implementation Example
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).PlatformId(
type: 0,
userIdentifier: "123456"
);
var result = await domain.AddPlatformIdSettingAsync(
);
var item = await result.ModelAsync(); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).PlatformId(
type: 0,
userIdentifier: "123456"
);
var future = domain.AddPlatformIdSettingFuture(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.ModelFuture();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result; const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->PlatformId(
0, // type
"123456" // userIdentifier
);
const auto Future = Domain->AddPlatformIdSetting(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();deletePlatformIdSetting
Delete Platform ID
Deletes the set Platform ID.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| type | int | ✓ | 0 ~ 1024 | Slot Number |
Result
| Type | Description | |
|---|---|---|
| item | EzPlatformId | Deleted platform ids |
Implementation Example
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).PlatformId(
type: 0,
userIdentifier: "123456"
);
var result = await domain.DeletePlatformIdSettingAsync(
); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).PlatformId(
type: 0,
userIdentifier: "123456"
);
var future = domain.DeletePlatformIdSettingFuture(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
} const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->PlatformId(
0, // type
"123456" // userIdentifier
);
const auto Future = Domain->DeletePlatformIdSetting(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
const auto Result = Future->GetTask().Result();findPlatformUser
Search for users by specifying platform type and user identifier
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| type | int | ✓ | 0 ~ 1024 | Slot Number | ||
| userIdentifier | string | ✓ | ~ 1024 chars | User ID on various platforms |
Result
| Type | Description | |
|---|---|---|
| item | EzPlatformUser | Various platform user information |
Implementation Example
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).PlatformId(
type: 0,
userIdentifier: "123456"
);
var result = await domain.FindPlatformUserAsync(
);
var item = await result.ModelAsync(); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).PlatformId(
type: 0,
userIdentifier: "123456"
);
var future = domain.FindPlatformUserFuture(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.ModelFuture();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result; const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->PlatformId(
0, // type
"123456" // userIdentifier
);
const auto Future = Domain->FindPlatformUser(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();getPlatformId
Get takeover settings by specifying user ID
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| type | int | ✓ | 0 ~ 1024 | Slot Number |
Result
| Type | Description | |
|---|---|---|
| item | EzPlatformId | platform ids |
Implementation Example
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).PlatformId(
type: 0,
userIdentifier: "123456"
);
var item = await domain.ModelAsync(); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).PlatformId(
type: 0,
userIdentifier: "123456"
);
var future = domain.ModelFuture();
yield return future;
var item = future.Result; const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->PlatformId(
0, // type
"123456" // userIdentifier
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}Value change event handling
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).PlatformId(
type: 0,
userIdentifier: "123456"
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).PlatformId(
type: 0,
userIdentifier: "123456"
);
var future = domain.ModelFuture();
yield return future;
var item = future.Result; const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->PlatformId(
0, // type
"123456" // userIdentifier
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Account::Model::FPlatformId> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(CallbackId);Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
listPlatformIdSettings
Get a list of Platform IDs that have been set
You can get a list of Platform IDs that have been set by game players.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name This name is used to identify the namespace and is specified in alphanumeric characters. | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
| Type | Description | |
|---|---|---|
| items | List<EzPlatformId> | List of Platform Id Setting |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.PlatformIdsAsync(
).ToListAsync(); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.PlatformIds(
);
List<EzPlatformId> items = new List<EzPlatformId>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
} const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
);
const auto It = Domain->PlatformIds(
);
TArray<Gs2::UE5::Account::Model::FEzPlatformIdPtr> Result;
for (auto Item : *It)
{
if (Item.IsError())
{
return false;
}
Result.Add(Item.Current());
}Value change event handling
var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
// Start event handling
var callbackId = domain.SubscribePlatformIds(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribePlatformIds(callbackId); var domain = gs2.Account.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.PlatformIds(
);
List<EzPlatformId> items = new List<EzPlatformId>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
} const auto Domain = Gs2->Account->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
);
// Start event handling
const auto CallbackId = Domain->SubscribePlatformIds(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribePlatformIds(CallbackId);Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.