Token Release
This API logs out the currently logged-in account.
URL Confirmation
This API uses the service-account.playnanoo.com domain.
API Information
- URL:
https://service-account.playnanoo.com/api/v20240401/token/signout - Method:
PUT - Authentication Required: Yes
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| platform | string | Required | Platform (e.g., "aos", "ios") |
| device_id | string | Required | Device unique ID |
| device_model | string | Required | Device model name |
| device_os | string | Required | Device OS |
| device_language | string | Required | Device language (e.g., "KO", "EN") |
DeviceInfo Inheritance
The Req class for this API inherits from DeviceInfo. All properties of DeviceInfo are automatically included.
Response Data
Res Class
| Field | Type | Description |
|---|---|---|
| Status | string | Status value |
Unity C# Implementation
BaseResponse Class
Base class for all API responses.
public class BaseResponse
{
public string ErrorCode;
public string Message;
public string WithdrawalKey;
public string BlockKey;
}
Field descriptions:
ErrorCode: Error codeMessage: Error messageWithdrawalKey: Key required for recovery when the account is in withdrawal grace period (only provided for accounts in withdrawal grace period)BlockKey: Key provided when the account is blocked (only provided for blocked accounts)
Logout Class
using System;
using System.Collections;
using UnityEngine.Networking;
public class TokenSignOut
{
static string path = "https://service-account.playnanoo.com/api/v20240401/token/signout";
[Serializable]
public class Req : DeviceInfo
{
public IEnumerator Send(
Action<Res> onSuccess,
Action<BaseResponse> onError)
{
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public string Status;
}
}
Usage Example
public void SignOut()
{
TokenSignOut.Req req = new TokenSignOut.Req();
StartCoroutine(req.Send(
onSuccess: res =>
{
Debug.Log($"로그아웃 성공: {res.Status}");
// 로컬에 저장된 토큰 삭제
PlayerPrefs.DeleteKey("AccessToken");
PlayerPrefs.DeleteKey("RefreshToken");
PlayerPrefs.Save();
},
onError: (error) =>
{
Debug.LogError($"로그아웃 실패: [{error.ErrorCode}] [{error.Message}]");
}
));
}
Post-Logout Processing
Upon successful logout, it is recommended to delete the locally stored access token and refresh token.