인증
토스 로그인 및 사용자 인증 관련 API예요.
API
| API | 반환 타입 | 설명 |
|---|---|---|
AIT.AppLogin() | AppLoginResult | 토스 로그인을 실행해요 |
AIT.GetIsTossLoginIntegratedService() | bool? | 토스 로그인 연동 여부를 확인해요 |
AppLogin
토스 로그인을 실행해요.
csharp
try
{
var result = await AIT.AppLogin();
Debug.Log($"로그인 결과: {result}");
}
catch (AITException ex)
{
Debug.LogError($"로그인 실패: {ex.Message}");
}GetIsTossLoginIntegratedService
현재 사용자가 토스 로그인이 연동된 유저인지 확인해요.
csharp
try
{
bool? isIntegrated = await AIT.GetIsTossLoginIntegratedService();
if (isIntegrated == true)
{
Debug.Log("토스 로그인 연동 유저");
}
else if (isIntegrated == false)
{
Debug.Log("토스 로그인 미연동 유저");
}
else
{
Debug.Log("앱 버전이 최소 지원 버전보다 낮아요");
}
}
catch (AITException ex)
{
Debug.LogError($"연동 여부 확인 실패: {ex.Message}");
}| 반환 값 | 설명 |
|---|---|
true | 토스 로그인이 연동된 유저예요 |
false | 토스 로그인이 연동되지 않은 유저예요 |
null | 앱 버전이 최소 지원 버전보다 낮아요 |
인증 플로우 예제
토스 로그인 연동 여부를 확인하고 로그인을 실행하는 예제예요.
csharp
using AppsInToss;
using UnityEngine;
public class AuthExample : MonoBehaviour
{
async void Start()
{
try
{
// 1. 토스 로그인 연동 여부 확인
bool? isIntegrated = await AIT.GetIsTossLoginIntegratedService();
if (isIntegrated != true)
{
// 2. 토스 로그인 실행
var result = await AIT.AppLogin();
Debug.Log($"로그인 완료: {result}");
}
Debug.Log("인증 완료");
}
catch (AITException ex)
{
Debug.LogError($"인증 실패: {ex.Message}");
}
}
}