iOS
This article guides you through setting up Kakao as an identity provider, enabling your iOS 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.
Go to Kakao Developers.
Create an app and enter the basic app info.
Enter app configurations for the iOS platform.
If clicking KakaoTalk message requires redirecting the user to a URL, register the URL domain to the Site domain in the Web platform.
2. Enable Kakao login for the app
Set Kakao Login Activation state to ON.
Add
https://kauth.kakao.com/oauth
in the Redirect URI.Set the login permission and scope based on the following image.
For example, the scope to access nickname and profile image after login.
3. Retrieve app information
Go to My Application > App Settings > Summary to view basic application information.
- Create an account for Player Network Console.
- Create a new project for your game, or join an existing one.
- Download the SDK.
- Integrate the SDK.
- Add Kakao as an authentication method for your project on Player Network Console.
Step 1: Configure the SDK for Kakao login
Kakao SDK is only compatible with iOS 12.0 or later.
In
info.plist
, add the following game configuration:<key>KakaoGameConfiguration</key>
<dict>
<key>AppId</key>
<string>{INTL_KAKAO_APP_ID}</string>
<key>AppSecret</key>
<string>{INTL_KAKAO_APP_SECRET}</string>
<key>AppVersion</key>
<string>1.0.0</string>
<key>DebugLevel</key>
<string>verbose</string>
<key>ServerType</key>
<string>real</string>
</dict>- Replace
{INTL_KAKAO_APP_SECRET}
with the Native app key in the Retrieve Kakao Info. - Replace
{INTL_KAKAO_APP_ID}
with the App ID in the Retrieve Kakao Info.
- Replace
In
info.list
, add the followingLSApplicationQueriesSchemes
code:<key>LSApplicationQueriesSchemes</key>
<array><string>com.kakaogames.sdk</string>
<string>kakao[AppSecret]</string>
<string>kakaokompassauth</string>
<string>storykompassauth</string>
<string>kakaolink</string>
<string>kakaotalk-4.5.0</string>
<string>kakaotalk-2.9.5</string>
<string>kakaotalk-3.0.0</string>
<string>kakao3rdauth</string>
<string>kakaostory-2.9.0</string>
<string>kakaotalk</string>
</array>Replace
[AppSecret]
with the Native app key in the Retrieve Kakao Info.Set URL Scheme.
Add the following schema code for KakaoTalk to open the game app:
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string></string>
<key>CFBundleURLSchemes</key>
<array>
<string>kakao[AppSecret]</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>kakaogame[AppId]</string>
</array>
</dict>- Replace
[AppSecret]
with the Native app key in the Retrieve Kakao Info. - Replace
[AppId]
with the App ID in the Retrieve Kakao Info.
- Replace
Step 2: Add Kakao login
Please verify web login on browsers supporting Chrome Custom Tabs such as Chrome.
Add an observer to handle authentication callbacks.
- Unity
- Unreal Engine
// 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";
}
}C++ Event Handling (above v1.15)
//configure callback
FINTLAuthEvent authEvent;
authEvent.AddUObject(this, &OnAuthResult_Implementation);
UINTLSDKAPI::SetAuthResultObserver(authEvent);
// Remove callbacks
UINTLSDKAPI::GetAuthResultObserver().Clear();void OnAuthResult_Implementation(FINTLAuthResult ret)
{
UE_LOG(LogTemp, Warning, TEXT("MethodID: %d"), ret.MethodId);
}Unreal Event Handling
void OnAuthResult_Implementation(FINTLAuthResult ret)
{
UE_LOG(LogTemp, Warning, TEXT("MethodID: %d"), ret.MethodId);
}Call the
AutoLogin
method.- Unity
- Unreal Engine
INTLAPI.AutoLogin();
UINTLSDKAPI::AutoLogin();
Call the
Login
method to ask for user input if auto-login fails.- Unity
- Unreal Engine
INTLAPI.Login(INTLChannel.KaKao);
UINTLSDKAPI::Login(EINTLLoginChannel::kChannelKaKao);
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.