Skip to main content

Android

This article guides you through setting up Kakao as an identity provider, enabling your Android game to access Player Network authentication services.

Prerequisites

1. Set up the Kakao app on Kakao Developers
1. Create a Kakao app

Go to Kakao Developers to register for a developer account, and contact an admin on Player Network to authenticate the business account.

  1. Go to Kakao Developers.

  2. Create an app and enter the basic app info.

    Image: Kakao Add Application

  3. Enter app configurations for the Android platform.

caution

If clicking KakaoTalk message requires redirecting the user to a URL, register the URL domain to the Site domain in the Web platform.

Image: Kakao Platforms

2. Enable Kakao login for the app
  1. Set Kakao Login Activation state to ON.

  2. Add https://kauth.kakao.com/oauth in the Redirect URI.

    Image: Kakao Activation

  3. Set the login permission and scope based on the following image.
    For example, the scope to access nickname and profile image after login.

    Image: Kakao Consent

3. Retrieve app information

Go to My Application > App Settings > Summary to view basic application information.

Image: Kakao Summary

  1. Create an account for Player Network Console.
  2. Create a new project for your game, or join an existing one.
  3. Download the SDK.
  4. Integrate the SDK.
  5. Add Kakao as an authentication method for your project on Player Network Console.

Step 1: Configure the SDK for Kakao login

note
Requirements

JDK:JDK8+
AndroidSdk:Android12.0(API31)
OS:Android 5.0, API 21 or higher supported
Gradle Version:6.1.1+
Android Gradle Plugin Version:3.6.1+

note

If the minSdkVersion does not match, add the following code in AndroidManifest.xml:

<uses-sdk tools:overrideLibrary="com.kakaogame.kakao,com.kakao.sdk.v2.story,com.kakao.sdk.v2.partner.user,
com.kakao.sdk.v2.user,com.kakao.sdk.v2.partner.auth,com.kakao.sdk.v2.partner.talk,
com.kakao.sdk.v2.talk,com.kakao.sdk.v2.auth,com.kakaogame,com.kakaogame.common,com.kakao.sdk.v2.partner,
com.kakao.sdk.v2.link,com.kakao.sdk.v2.template,com.kakao.sdk.v2.network,
com.kakao.sdk.v2.common,com.kakao.sdk.v2.partner.friend" />
  1. In the kakao_game_sdk_configuration.xml file under Assets/Plugins/Android/INTLKaKao.androidlib/assets.

    <?xml version="1.0" encoding="UTF-8"?> 
    <configuartion-list>
    <configuration key="appId" value="" />
    <configuration key="appSecret" value="" />
    <configuration key="debugLevel" value="verbose" />
    </configuartion-list>
  2. In the AndroidManifest file, add the following code in the configured launch interface to ensure that players can open the game after clicking the app info in the KakaoTalk message.

    <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="kakao{INTL_KAKAO_APP_SECRET}" android:host="kakaolink"
    tools:ignore="AppLinkUrlError" />
    </intent-filter>
    <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="kakao{INTL_KAKAO_APP_SECRET}" android:host="kakaostory"
    tools:ignore="AppLinkUrlError" />
    </intent-filter>

    Replace {INTL_KAKAO_APP_SECRET} with the Native app key in the Retrieve Kakao Info.

  3. Open the project's INTLConfig.ini:

    [Android LifeCycle]
    LIFECYCLE = KaKao
    [KaKao]
    KAKAO_APP_SECRET = {INTL_KAKAO_APP_SECRET}
    KAKAO_APP_ID = {INTL_KAKAO_APP_ID}

Step 2: Add Kakao login

caution

Please verify web login on browsers supporting Chrome Custom Tabs such as Chrome.

  1. Add an observer to handle authentication callbacks.

    // Add callbacks
    public void AddAuthObserver()
    {
    INTLAPI.AddAuthResultObserver(OnAuthResultEvent);
    }

    // Remove callbacks
    public void RemoveAuthObserver()
    {
    INTLAPI.RemoveAuthResultObserver(OnAuthResultEvent);
    }

    // Process the INTLAuthResult callback
    public void OnAuthResultEvent(INTLAuthResult ret)
    {
    Debug.Log($"MethodID: {ret.MethodId}");

    string methodTag = "";
    if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_LOGIN)
    {
    methodTag = "Login";
    }
    else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_BIND)
    {
    methodTag = "Bind";
    }
    else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_AUTOLOGIN)
    {
    methodTag = "AutoLogin";
    }
    else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_QUERY_USER_INFO)
    {
    methodTag = "QueryUserInfo";
    }
    else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_GET_AUTH_RESULT)
    {
    methodTag = "GetAuthResult";
    }
    }
  2. Call the AutoLogin method.

    INTLAPI.AutoLogin();
  3. Call the Login method to ask for user input if auto-login fails.

    INTLAPI.Login(INTLChannel.KaKao); 
  4. Sync client authentication state with the game's backend and wait for the final authentication result.

Step 3: Test the login function

Search for the keyword "AuthResult" in the Player Network SDK logs to verify if the correct channel name and OpenID are returned. If they are, it indicates a successful configuration and the login function has been added successfully.