본문으로 건너뛰기

계정 등록 및 인증

구글 아이디를 활용하여 회원 가입 및 인증을 합니다.
iOS, 안드로이드 통합 사용 가능 합니다.

호출 정보

SocialSignIn(string googleIdToken, string accountType, PlayNANOODelegate callback) {}

호출 상세 정보

파라미터설명타입
googleIdToken구글 ID TokenString
accountType계정 타입String
callback통신 결과PlayNANOODelegate

소스 코드

using System;
using System.Threading.Tasks;
using Google;
using PlayNANOO;

public class PlayNANOOExample : MonoBehaviour
{
Plugin plugin;
Queue<bool> queue;
string token;
GoogleSignInConfiguration googleSignInConfiguration;

void Start()
{
plugin = Plugin.GetInstance();

queue = new Queue<bool>();
googleSignInConfiguration = new GoogleSignInConfiguration
{
RequestIdToken = true,
WebClientId = "웹클라이언트 ID를 입력합니다.",
};
}

public void SignIn()
{
GoogleSignIn.Configuration = googleSignInConfiguration;
GoogleSignIn.Configuration.UseGameSignIn = false;
GoogleSignIn.Configuration.RequestIdToken = true;
GoogleSignIn.DefaultInstance.SignIn().ContinueWith(OnAuthenticationFinished);
}

void Update()
{
Services();
}

void Services()
{
while (queue.Count > 0)
{
bool isResult = queue.Dequeue();
if (isResult)
{
plugin.AccountManagerV20240401.SocialSignIn(task.Result.IdToken, Configure.PN_ACCOUNT_GOOGLE, (status, errorCode, jsonString, values) =>
{
if (status == Configure.PN_API_STATE_SUCCESS)
{
Debug.Log(values["access_token"].ToString());
Debug.Log(values["refresh_token"].ToString());
Debug.Log(values["uuid"].ToString());
Debug.Log(values["openID"].ToString());
Debug.Log(values["nickname"].ToString());
Debug.Log(values["linkedID"].ToString());
Debug.Log(values["linkedType"].ToString());
Debug.Log(values["country"].ToString());
Debug.Log(values["purchaseCount"].ToString());
Debug.Log(values["purchaseTotalPrice"].ToString());
Debug.Log(values["purchaseCurrencyCode"].ToString());
Debug.Log(values["purchaseVoidedCount"].ToString());
Debug.Log(values["purchaseVoidedTotalPrice"].ToString());
Debug.Log(values["purchaseVoidedCurrencyCode"].ToString());
Debug.Log(values["country"].ToString());
Debug.Log(values["timezone"].ToString());
Debug.Log(values["offset"].ToString());
Debug.Log(values["joinPeriod"].ToString());
}
else
{
if (values != null)
{
if (values["ErrorCode"].ToString() == "30007")
{
Debug.Log(values["WithdrawalKey"].ToString());
}
else if (values["ErrorCode"].ToString() == "70002")
{
Debug.Log(values["BlockKey"].ToString());
}
else
{
Debug.Log("Fail");
}
}
else
{
Debug.Log("Fail");
}
}
});
}
else
{
Debug.Log("Fail");
}
}
}

internal void OnAuthenticationFinished(Task<GoogleSignInUser> task)
{
if (task.IsFaulted)
{
using (IEnumerator<System.Exception> enumerator = task.Exception.InnerExceptions.GetEnumerator())
{
if (enumerator.MoveNext())
{
GoogleSignIn.SignInException error = (GoogleSignIn.SignInException)enumerator.Current;
Debug.Log("Got Error: " + error.Status + " " + error.Message);
queue.Enqueue(false);
}
else
{
Debug.Log("Got Unexpected Exception?!?" + task.Exception);
}
}
}
else if (task.IsCanceled)
{
Debug.Log("Canceled");
}
else
{
token = task.Result.IdToken;
queue.Enqueue(true);
}
}
}

통신 결과

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"Token" : {
"AccessToken" : "String",
"RefreshToken" : "String"
},
"Player" : {
"UserUniqueID" : "String",
"OpenID" : "String",
"Nickname" : "String",
"LinkedID" : "String",
"LinkedType" : "String",
"PurchaseCount" : "Integer",
"PurchaseTotalPrice" : "Double",
"PurchaseCurrencyCode" : "String",
"PurchaseVoidedCount" : "Integer",
"PurchaseVoidedTotalPrice" : "Double",
"PurchaseVoidedCurrencyCode" : "String",
"Country" : "String",
"Timezone" : "String",
"Offset" : "Integer",
"JoinPeriod" : "Integer"
}
}

통신 결과 상세 정보

데이터키설명타입
Token.AccessToken플레이어 접속 토큰string
Token.RefreshToken플레이어 갱신 토큰string
Player.UserUniqueID플레이어 고유 식별 아이디string
Player.OpenID플레이어 고유 식별 오픈 아이디string
Player.Nickname플레이어 닉네임string
Player.LinkedID플레이어 연결 식별 아이디string
Player.LinkedType플레이어 연결 타입string
Player.PurchaseCount플레이어 결제 횟수integer
Player.PurchaseTotalPrice플레이어 결제 누적 금액double
Player.PurchaseCurrencyCode플레이어 결제 화폐string
Player.PurchaseVoidedCount플레이어 결제 환불 횟수integer
Player.PurchaseVoidedTotalPrice플레이어 결제 환불 누적 금액double
Player.PurchaseVoidedCurrencyCode플레이어 결제 환불 화폐string
Player.Country플레이어 국가 코드string
Player.Timezone플레이어 국가 타임존string
Player.Offset플레이어 타임존 시간차이 (UTC 기준)integer
Player.JoinPeriod플레이어 가입 기간integer
WithdrawalKey탈퇴 계정 조회 키string

에러 정보

플레이어 정보가 존재하지 않을 경우.
ErrorCode : 30000
ErrorMessage : NotFoundAccountException

플레이어 정보가 다른 디바이스에서 사용 중인 경우
ErrorCode : 30006
ErrorMessage : DuplicatedDeviceException

플레이어가 탈퇴를 신청한 경우
ErrorCode : 30007
ErrorMessage : WithDrawalException