5.1. Connect Account Example
5.1. Connect Account Example
5.1.1. Connect Account Example
When the Connect Account API which uses the basic account connection UI is called, a window appears as below asking you to decide which IDP you will use.
In the event that the developer wants to implement the account connection UI (i.e. the developer does not want to use the basic account connection UI), connect account API by IDP is provided. In this case, a connect account button for each IDP should be placed in the account connection screen, and when each button is clicked, the connect account API for each IDP should be called.
5.1.2. Connect accounts using the basic account connection UI
The following is an example of connect account using the basic account connection UI.
Connect to other IDP accounts is available only after the guest, SIWA(in Korea, iPhone only) has been authenticated. Otherwise, you have to deactive the account connection UI.
If connect account is successful, the player ID is maintained.
Unity
using Kakaogame.SDK;
KGSession.Connect(
(result) => {
if (result.isSuccess) {
// Account connection successful
// The player ID is not changed.
}
else if (result.code == KGResultCode.NotAuthorized) {
// If currently not authenticated
}
else if (result.code == KGResultCode.InvalidState) {
// If currently authenticated IDP is not guest, or SIWA(in Korea, iPhone only)
}
else if (result.code == KGResultCode.AlreadyUsedIdpAccount) {
// If trying to convert to an already used IDP account
}
else {
// Other errors
}
}); |
Android
// Connect Account
KGSession.connect(activity, new KGResultCallback<Void>() {
@Override
public void onResult(KGResult<Void> result) {
if (result.isSuccess()) {
// Account connection successful
// The player ID is not changed.
} else {
// Account connection failed
if (result.getCode() == KGResult.KGResultCode.INVALID_PARAMETER) {
// If activity is null
} else if (result.getCode() == KGResult.KGResultCode.NOT_AUTHORIZED) {
// If currently not authenticated
} else if (result.getCode() == KGResult.KGResultCode.INVALID_STATE) {
// If currently authenticated IDP is not guest.
} else if (result.getCode() == KGResult.KGResultCode.ALREADY_USED_IDP_ACCOUNT) {
// If trying to convert to an already used IDP account
} else {
// Other errors
}
}
}
}); |
iOS
#import <KakaoGame/KakaoGame.h>
// Connect Account
[KGSession connectWithCompletionHandler:^(NSError *error) {
if (IS_SUCCESS(error) == YES)
{
// Account connection successful
// The player ID is not changed.
}
else
{
// Account connection failed
if (error.code == KGErrorNotAuthorized)
{
// If currently not authenticated
}
else if (error.code == KGErrorInvalidState)
{
// If currently authenticated IDP is not guest, or SIWA(in Korea only)
}
else if (error.code == KGErrorAlreadyUsedIdpAccount)
{
// If trying to convert to an already used IDP account
}
else
{
// Other errors
}
}
}]; |
Unreal
5.1.3. Connect accounts not using the basic account connection UI
The following is an example of connect account not using the basic account connection UI.
Connect to other IDP accounts is available only after the guest, SIWA(in Korea, iPhone only) has been authenticated. Otherwise, you have to deactive the account connection UI.
If connect account is successful, the player ID is maintained.
Unity
Android
iOS
Windows Sync
Windows Async
Unreal
5.1.4. Kacao 'app-to-web' login without the default account connection UI (3.8.0+)
This is an example of implementing a Kacao 'app-to-web' login when connecting accounts that do not use the default account connection UI.
Connect to other IDP accounts is available only after the guest, SIWA(in Korea, iPhone only) has been authenticated. Otherwise, you have to deactive the account connection UI.
If connect account is successful, the player ID is maintained.
In the version below 3.8.0, only the 'app-to-app' authentication was supported when KakaoTalk app was installed by default. You can use the following APIs to allow users to select 'Kakao app' or 'web' authentication to log in, or to perform an 'app-to-web' authentication.
Unity
Android
iOS
Unreal