계정 등록 및 인증
구글 아이디를 활용하여 회원 가입 및 인증을 합니다.
iOS, 안드로이드 통합 사용 가능 합니다.
호출 정보
SocialSignIn(string googleIdToken, string accountType, PlayNANOODelegate callback) {}
호출 상세 정보
파라미터 | 설명 | 타입 |
---|---|---|
googleIdToken | 구글 ID Token | String |
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