유효성 검증
액세스 토큰의 유효성과 상태를 확인하는 API입니다.
URL 확인
이 API는 service-account.playnanoo.com 도메인을 사용합니다.
API 정보
- URL:
https://service-account.playnanoo.com/api/v20240401/token/status - Method:
PUT - 인증 필요: 아니오
요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
| access_token | string | 필수 | 확인할 액세스 토큰 |
| platform | string | 필수 | 플랫폼 (예: "aos", "ios") |
| device_id | string | 필수 | 기기 고유 ID |
| device_model | string | 필수 | 기기 모델명 |
| device_os | string | 필수 | 기기 OS |
| device_language | string | 필수 | 기기 언어 (예: "KO", "EN") |
DeviceInfo 상속
이 API의 Req 클래스는 DeviceInfo를 상속받습니다. DeviceInfo의 모든 속성이 자동으로 포함됩니다.
응답 데이터
Res 클래스
| 필드 | 타입 | 설명 |
|---|---|---|
| Status | string | 토큰 상태 |
| WithdrawalKey | string | 탈퇴 키 (탈퇴 대기 중인 경우) |
Unity C# 구현
BaseResponse 클래스
모든 API 응답의 기본 클래스입니다.
public class BaseResponse
{
public string ErrorCode;
public string Message;
public string WithdrawalKey;
public string BlockKey;
}
필드 설명:
ErrorCode: 에러 코드Message: 에러 메시지WithdrawalKey: 탈퇴 유예 상태인 경우 복구에 필요한 키 (탈퇴 유예 중인 계정만 제공)BlockKey: 차단된 계정인 경우 제공되는 키 (차단된 계정만 제공)
토큰 상태 확인 클래스
using System;
using System.Collections;
using UnityEngine.Networking;
public class TokenStatus
{
static string path = "https://service-account.playnanoo.com/api/v20240401/token/status";
[Serializable]
public class Req : DeviceInfo
{
public string access_token;
public IEnumerator Send(
string access_token,
Action<Res> onSuccess,
Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(access_token)) this.access_token = access_token;
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: false,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public string Status;
public string WithdrawalKey;
}
}
사용 예제
public void CheckTokenStatus(string accessToken)
{
TokenStatus.Req req = new TokenStatus.Req();
StartCoroutine(req.Send(
access_token: accessToken,
onSuccess: res =>
{
Debug.Log($"토큰 상태: {res.Status}");
if (!string.IsNullOrEmpty(res.WithdrawalKey))
{
Debug.Log($"탈퇴 대기 중 - WithdrawalKey: {res.WithdrawalKey}");
}
},
onError: (error) =>
{
Debug.LogError($"토큰 상태 확인 실패: [{error.ErrorCode}] [{error.Message}]");
}
));
}
토큰 상태 값
Status 필드의 가능한 값:
"active": 토큰이 유효하고 활성 상태"expired": 토큰이 만료됨"withdrawal": 탈퇴 대기 중