Social Login
This API allows login with social accounts (Google, Facebook, Apple, etc.).
URL Confirmation
This API uses the service-account.playnanoo.com domain.
API Information
- URL:
https://service-account.playnanoo.com/api/v20240101/social/signin - Method:
PUT - Authentication Required: No
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| request_uuid | string | Required | Request unique ID (UUID) |
| account_type | string | Required | Social account type (e.g., "google", "facebook", "apple") |
| account_token | string | Required | Social account access token |
| 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 |
|---|---|---|
| Token | SerializeTokenData | Token information |
| Player | SerializePlayerData | Player information |
SerializeTokenData Structure
| Field | Type | Description |
|---|---|---|
| AccessToken | string | Access token |
| RefreshToken | string | Refresh token |
SerializePlayerData Structure
| Field | Type | Description |
|---|---|---|
| UserUniqueID | string | User unique ID |
| OpenID | string | Open ID |
| Nickname | string | Nickname |
| LinkedID | string | Linked ID |
| LinkedType | string | Linked type |
| PurchaseCount | int | Purchase count |
| PurchaseCurrencyCode | string | Purchase currency code |
| PurchaseTotalPrice | double | Total purchase amount |
| PurchaseVoidedCount | int | Refund count |
| PurchaseVoidedCurrencyCode | string | Refund currency code |
| PurchaseVoidedTotalPrice | double | Total refund amount |
| Country | string | Country |
| Timezone | string | Timezone |
| Offset | int | Time offset |
| JoinPeriod | int | Join period |
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 pending withdrawal)BlockKey: Key provided when the account is blocked (only provided for blocked accounts)
Social Login Class
using System;
using System.Collections;
using UnityEngine.Networking;
public class SocialSignin
{
static string path = "https://service-account.playnanoo.com/api/v20240101/social/signin";
[Serializable]
public class Req : DeviceInfo
{
public string request_uuid;
public string account_type;
public string account_token;
public IEnumerator Send(
string request_uuid,
string account_type,
string account_token,
Action<Res> onSuccess,
Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(request_uuid)) this.request_uuid = request_uuid;
if (!string.IsNullOrEmpty(account_type)) this.account_type = account_type;
if (!string.IsNullOrEmpty(account_token)) this.account_token = account_token;
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: false,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public SerializeTokenData Token;
public SerializePlayerData Player;
}
[Serializable]
public class SerializeTokenData
{
public string AccessToken;
public string RefreshToken;
}
[Serializable]
public class SerializePlayerData
{
public string UserUniqueID;
public string OpenID;
public string Nickname;
public string LinkedID;
public string LinkedType;
public int PurchaseCount;
public string PurchaseCurrencyCode;
public double PurchaseTotalPrice;
public int PurchaseVoidedCount;
public string PurchaseVoidedCurrencyCode;
public double PurchaseVoidedTotalPrice;
public string Country;
public string Timezone;
public int Offset;
public int JoinPeriod;
}
}
Usage Examples
Google Login
public void GoogleSignIn(string googleAccessToken)
{
SocialSignin.Req req = new SocialSignin.Req();
StartCoroutine(req.Send(
request_uuid: Guid.NewGuid().ToString(),
account_type: "google",
account_token: googleAccessToken,
onSuccess: res =>
{
// 토큰
Debug.Log($"AccessToken: {res.Token.AccessToken}");
Debug.Log($"RefreshToken: {res.Token.RefreshToken}");
// 플레이어 정보
Debug.Log($"UserUniqueID: {res.Player.UserUniqueID}");
Debug.Log($"OpenID: {res.Player.OpenID}");
Debug.Log($"Nickname: {res.Player.Nickname}");
Debug.Log($"LinkedID: {res.Player.LinkedID}");
Debug.Log($"LinkedType: {res.Player.LinkedType}");
},
onError: (error) =>
{
Debug.LogError($"Google 로그인 실패: [{error.ErrorCode}] [{error.Message}]");
}
));
}
Facebook Login
public void FacebookSignIn(string facebookAccessToken)
{
SocialSignin.Req req = new SocialSignin.Req();
StartCoroutine(req.Send(
request_uuid: Guid.NewGuid().ToString(),
account_type: "facebook",
account_token: facebookAccessToken,
onSuccess: res =>
{
Debug.Log("Facebook 로그인 성공!");
Debug.Log($"UserUniqueID: {res.Player.UserUniqueID}");
},
onError: (error) =>
{
Debug.LogError($"Facebook 로그인 실패: [{error.ErrorCode}] [{error.Message}]");
}
));
}
Apple Login
public void AppleSignIn(string appleIdToken)
{
SocialSignin.Req req = new SocialSignin.Req();
StartCoroutine(req.Send(
request_uuid: Guid.NewGuid().ToString(),
account_type: "apple",
account_token: appleIdToken,
onSuccess: res =>
{
Debug.Log("Apple 로그인 성공!");
Debug.Log($"UserUniqueID: {res.Player.UserUniqueID}");
},
onError: (error) =>
{
Debug.LogError($"Apple 로그인 실패: [{error.ErrorCode}] [{error.Message}]");
}
));
}
Supported Social Account Types
| account_type | Description | Required Token |
|---|---|---|
| Google account | Google OAuth2 Access Token | |
| Facebook account | Facebook Access Token | |
| apple | Apple account | Apple ID Token |
Social Login SDKs
To implement login for each social platform, you need the corresponding platform's SDK:
- Google: Google Sign-In for Unity
- Facebook: Facebook SDK for Unity
- Apple: Sign in with Apple (iOS 13+)
request_uuid
request_uuid is a UUID to uniquely identify each login request. You can generate it using Guid.NewGuid().ToString().