Skip to content
이 내용이 도움이 되었나요?

인증

토스 로그인 및 사용자 인증 관련 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}");
        }
    }
}