API Reference of GS2-Auth SDK for Game Engine
Model
EzAccessToken
| Type | Require | Default | Limitation | Description |
---|
token | string | ✓ | | ~ 1024 chars | Access token |
userId | string | ✓ | | ~ 128 chars | User Id |
expire | long | ✓ | Difference from current time(1 hours) | Effective date | |
Methods
login
Log in to GS2 with the specified user ID
Specify the result of GS2-Account::Authentication for body and signature.
If body and signature are successfully verified, an access token
is responded.
The access token
is temporary authentication information with an expiration time of one hour, and is used to identify the game player for each service in GS2.
The Game Engine SDK for Unity and Unreal Engine 5 provides GS2-Account::Authentication and Profile::Login, which combines this API.
Profile::Login is explained in API Reference / Initialization Process / Game Engine.
Request
| Type | Require | Default | Limitation | Description |
---|
keyId | string | ✓ | | ~ 1024 chars | encryption key GRN |
body | string | ✓ | | ~ 1048576 chars | Account credentials to be signed |
signature | string | ✓ | | ~ 1024 chars | signature |
Result
| Type | Description |
---|
token | string | access token |
userId | string | User Id |
expire | long | effective date |
Implementation Example
var domain = gs2.Auth.AccessToken(
);
var result = await domain.LoginAsync(
keyId: "key-0001",
body: "body",
signature: "signature"
);
var token = result.Token;
var userId = result.UserId;
var expire = result.Expire;
var domain = gs2.Auth.AccessToken(
);
var future = domain.LoginFuture(
keyId: "key-0001",
body: "body",
signature: "signature"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var token = future.Result.Token;
var userId = future.Result.UserId;
var expire = future.Result.Expire;
const auto Domain = Gs2->Auth->AccessToken(
);
const auto Future = Domain->Login(
"key-0001",
"body",
"signature"
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
const auto Token = Result->Token;
const auto UserId = Result->UserId;
const auto Expire = Result->Expire;