Skip to main content

v1 Account Registration and Authentication (End of Support Scheduled)

  • This feature has been deprecated by Google and will only be available until 2025.
  • Use Google ID for account registration and authentication.
  • Available for both iOS and Android.

Call Information

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

Call Details

ParameterDescriptionType
googleIdTokenGoogle ID TokenString
accountTypeAccount typeString
callbackCommunication ResultPlayNANOODelegate

Source Code

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);
}
}
}

Response

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"
}
}

Response Details

Data KeyDescriptionType
Token.AccessTokenPlayer access tokenstring
Token.RefreshTokenPlayer refresh tokenstring
Player.UserUniqueIDPlayer unique IDstring
Player.OpenIDPlayer unique open IDstring
Player.NicknamePlayer nicknamestring
Player.LinkedIDPlayer linked IDstring
Player.LinkedTypePlayer link typestring
Player.PurchaseCountPlayer purchase countinteger
Player.PurchaseTotalPricePlayer cumulative purchase amountdouble
Player.PurchaseCurrencyCodePlayer purchase currencystring
Player.PurchaseVoidedCountPlayer refund countinteger
Player.PurchaseVoidedTotalPricePlayer cumulative refund amountdouble
Player.PurchaseVoidedCurrencyCodePlayer refund currencystring
Player.CountryPlayer country codestring
Player.TimezonePlayer country timezonestring
Player.OffsetPlayer timezone offset (based on UTC)integer
Player.JoinPeriodPlayer membership durationinteger
WithdrawalKeyWithdrawal account lookup keystring

Error Information

If player information does not exist. ErrorCode : 30000 ErrorMessage : NotFoundAccountException

If player information is being used on another device ErrorCode : 30006 ErrorMessage : DuplicatedDeviceException

If the player has requested withdrawal ErrorCode : 30007 ErrorMessage : WithDrawalException