버전 비교

  • 이 줄이 추가되었습니다.
  • 이 줄이 삭제되었습니다.
  • 서식이 변경되었습니다.

...

코드 블럭
#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
        }
    }
}];

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

...

Unreal

코드 블럭
#include "KakaoGame.h"
  
FKGSession::Connect(FKGResultDelegate::CreateLambda([=](FKGResult result) {
  if (result.IsSuccess())
  {
    // Account connection successful
    // The player ID is not changed.
  }
  else if (result.GetCode() == FKGResultCode::NotAuthorized)
  {
    // If currently not authenticated
  }
  else if (result.GetCode() == FKGResultCode::InvalidState)
  {
    // If currently authenticated IDP is not guest, or SIWA(in Korea, iPhone only)
  }
  else if (result.GetCode() == FKGResultCode::AlreadyUsedIDPAccount)
  {
    // If trying to convert to an already used IDP account
        
  }
  else
        else 
  {
            
    // Other errors
        
  }
    
}));

Android

...

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

코드 블럭
using Kakaogame.SDK;
 
KGIdpCode idpCode = KGIdpCode.Kakao; // IDP to be used for account connection
 
// Connect accounts not using the basic account connection UI
KGSessionForCustomUI.Connect(
    idpCode,
    (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 

        else if (result.
getCode()
code == 
KGResult.
KGResultCode.
INVALID_STATE
InvalidState) {
                
            // If currently authenticated IDP is not guest
.             } else if (result.getCode() == KGResult.KGResultCode.ALREADY_USED_IDP_ACCOUNT
, or SIWA(in Korea, iPhone only)
        }
        else if (result.code == KGResultCode.AlreadyUsedIdpAccount) {
                
            // If trying to convert to an already used IDP account
            
        }
 else 

        else {
                
            // Other errors
            }

        }
    }
}
);

iOSAndroid

코드 블럭
#import <KakaoGame/KakaoGame.h>  
// Connect accounts not using the basic account connection UI
KGIdpProfile.KGIdpCode idpCode
= KGIdpCodeKakao
; // IDP to be used for account connection
 
[KGSessionForCustomUI connectWithIdpCode:idpCode completionHandler:^(NSError *error
KGSessionForCustomUI.connect(activity, idpCode, new KGResultCallback<Void>() {
    @Override
    public void onResult(KGResult<Void> result) {
    if (IS_SUCCESS(error) == YES)     {           
 
        if (result.isSuccess()) {
            // Account connection successful
        
            // The player ID is not changed.
    }     else     
        } else {
        
            // Account connection failed
 
        if 
            if (
error
result.
code
getCode() == 
KGErrorNotAuthorized
KGResult.KGResultCode.INVALID_PARAMETER) 
        
{
            
                // If 
currently
activity 
not
is 
authenticated
null
        
            }
        else if 
 else if (
error
result.
code
getCode() == 
KGErrorInvalidState
KGResult.KGResultCode.NOT_AUTHORIZED) 
        
{
            
                // If currently
authenticated IDP is
 not 
guest, or SIWA(in Korea only)         }         else if (error.code == KGErrorAlreadyUsedIdpAccount)         {               
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         
            } else {
            
                // Other errors
            }
        }
    }
}
]
);

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

코드 블럭using Kakaogame.SDK;   // Users select app or web authentication and sign in

iOS

코드 블럭
#import <KakaoGame/KakaoGame.h>
 
// Connect accounts not using the basic account connection UI
KGIdpCode idpCode = KGIdpCodeKakao; // IDP to be used for account connection
 
[KGSessionForCustomUI connectWithIdpCode:idpCode completionHandler:^(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
        }
    }
}];

Windows Sync

코드 블럭
#include "KakaoGameLib.h"
 
KakaoGame::API::KGSessionForCustomUI kgSessionForCustomUI;
KakaoGame::Data::KGResult result;
  
// IDP to be used for account connection
KakaoGame::Data::KGIdpCode idpCode;
 
// Connect accounts not using the basic account connection UI
kgSessionForCustomUI.connect(idpCode, result);
if (result.isSuccess()) {
    // Account connection successful
    // The player ID is not changed.
}
else if (KakaoGame::Data::KGResultCode::NotAuthorized == result.code) {
    // If currently not authenticated
}
else if (KakaoGame::Data::KGResultCode::NotSupported == result.code) {
    // Unable to connect idp
}
else if (KakaoGame::Data::KGResultCode::AlreadyUsedIDPAccount == result.code) {
    // If trying to convert to an already used IDP account
}
else {
    // Other errors
}

Windows Async

코드 블럭
#include "KakaoGameLib.h"
 
KakaoGame::API::KGSessionForCustomUI kgSessionForCustomUI;
KakaoGame::Data::KGResult result;
 
// IDP to be used for account connection
KakaoGame::Data::KGIdpCode idpCode;
 
// Connect accounts not using the basic account connection UI
kgSessionForCustomUI.connect(idpCode, [this](KakaoGame::Data::KGResult result) {
    if (result.isSuccess()) {
        // Account connection successful
        // The player ID is not changed.
    }
    else if (KakaoGame::Data::KGResultCode::NotAuthorized == result.code) {
        // If currently not authenticated
    }
    else if (KakaoGame::Data::KGResultCode::NotSupported == result.code) {
        // Unable to connect idp
    }
    else if (KakaoGame::Data::KGResultCode::AlreadyUsedIDPAccount == result.code) {
        // If trying to convert to an already used IDP account
    }
    else {
        // Other errors
    }
}, reinterpret_cast<HWND>(GEngine->GameViewport->GetWindow()->GetNativeWindow()->GetOSWindowHandle());

Unreal

코드 블럭
#include "KakaoGame.h"
  
// Connect accounts not using the basic account connection UI
EKGIdpCode idpCode = EKGIdpCode::Kakao; // IDP to be used for account connection
  
FKGSessionForCustomUI::Connect(idpCode, FKGResultDelegate::CreateLambda([=](FKGResult result) {
  if (result.IsSuccess())
  {
    // Account connection successful
    // The player ID is not changed.
  }
  else if (result.GetCode() == FKGResultCode::NotAuthorized)
  {
    // If currently not authenticated
  }
  else if (result.GetCode() == FKGResultCode::InvalidState)
  {
    // If currently authenticated IDP is not guest, or SIWA(in Korea only)
  }
  else if (result.GetCode() == FKGResultCode::AlreadyUsedIDPAccount)
  {
    // If trying to convert to an already used IDP account
  }
  else
  {
    // Other errors
  }
}));

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

코드 블럭
using Kakaogame.SDK;
 
// Users select app or web authentication and sign in
KGKakaoAuthType authType = KGKakaoAuthType.KakaoAllType;
// Login KakaoWeb
// KGKakaoAuthType authType = KGKakaoAuthType.KakaoWeb;
   
// Connect accounts that do not use the default account connection UI
KGSessionForCustomUI.ConnectKakao(
    authType,
    (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 accounts not using the basic account connection UI
  
// User selects 'app' or 'web' authentication and logs in
KGKakaoAuthType authType = KGKakaoAuthType.KakaoAllType;
// app to web login only
//// KGKakaoAuthType authType = KGKakaoAuthType.
KakaoAllType
KakaoWeb;
// Login KakaoWeb // KGKakaoAuthType authType = KGKakaoAuthType.KakaoWeb;     // Connect accounts that do not use the default account connection UI KGSessionForCustomUI.ConnectKakao(     authType,     (result) => {         if (result.isSuccess) {             // Account connection successful             // The player ID is not changed.         }         else if (result.code == KGResultCode.NotAuthorized) {             

 
KGSessionForCustomUI.connectKakao(getActivity(), authType, 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 
 else if (result.
code
getCode() == KGResult.KGResultCode.
InvalidState
INVALID_STATE) {
            
                // If currently authenticated IDP is not guest
, or SIWA(in Korea, iPhone only)         }         else if 
.
            } else if (result.
code
getCode() == KGResult.KGResultCode.
AlreadyUsedIDPAccount
ALREADY_USED_IDP_ACCOUNT) {
            
                // If trying to convert to an already used IDP account
        
            }
        else 
 else {
            
                // Other errors
            }
        }
    }
});

AndroidiOS

코드 블럭
// Connect accounts not using the basic account connection UI
#import <KakaoGame/KakaoGame.h>
 
  
// 
User
Users 
selects
select 
'
app
'
 or 
'
web
'
 authentication and 
logs
sign in
KGKakaoAuthType authType = 
KGKakaoAuthType.KakaoAllType
KGKakaoAuthTypeKakaoAllType;
// 
app to web login only
Login KakaoWeb
//// KGKakaoAuthType authType = 
KGKakaoAuthType.KakaoWeb;   KGSessionForCustomUI.connectKakao(getActivity(), authType, new KGResultCallback<Void>() {     @Override     public void onResult(KGResult<Void> result) {         if (result.isSuccess()) {             
KGKakaoAuthTypeKakaoWeb;
   
// Connect accounts that do not use the default account connection UI
[KGSessionForCustomUI connectKakaoWithKakaoAuthType:authType completionHandler:^(NSError *error) {
     if (IS_SUCCESS(error) == YES) {
        // 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) {                 
 not changed.
    }
    else {
        // Account connection failed
        if (error.code == KGErrorNotAuthorized) {
            // If currently not authenticated
            
        }
 else if 

        else if (
result
error.
getCode()
code == 
KGResult.KGResultCode.INVALID_STATE
KGErrorInvalidState) {
                
            // If currently authenticated IDP is not guest
.             } else if (result.getCode()
, or SIWA(in Korea only)
        }
        else if (error.code == 
KGResult.KGResultCode.ALREADY_USED_IDP_ACCOUNT
KGErrorAlreadyUsedIdpAccount) {
                
            // If trying to convert to an already used IDP account
            
        }
 else 

        else {
                
            // Other errors
            }

        }
    }
}
)
];

iOSUnreal

코드 블럭
#import
#include 
<KakaoGame/
"KakaoGame.
h>  
h"
  
// Users select app or web authentication and sign in
KGKakaoAuthType
EKGKakaoAuthType authType = 
KGKakaoAuthTypeKakaoAllType;
EKGKakaoAuthType::KakaoAllType;
 
// Login KakaoWeb
//
//
 
KGKakaoAuthType
EKGKakaoAuthType authType = 
KGKakaoAuthTypeKakaoWeb;     // Connect accounts that do not use the default account connection UI [KGSessionForCustomUI connectKakaoWithKakaoAuthType:authType completionHandler:^(NSError *error
EKGKakaoAuthType.KakaoWeb;
 
FKGSessionForCustomUI::ConnectKakao(authType, FKGResultDelegate::CreateLambda([=](FKGResult result) {
     if (IS_SUCCESS(error) == YES) {         
  if (result.IsSuccess())
  {
    // Account connection successful
        
    // The player ID is not changed.
    
  }
    else {         // Account connection failed         if (error.code
  else if (result.GetCode() == 
KGErrorNotAuthorized
FKGResultCode::NotAuthorized)
  {
            
    // If currently not authenticated
        
  }
        else if 
  else if (
error
result.
code
GetCode() == 
KGErrorInvalidState
FKGResultCode::InvalidState)
  {
            
    // If currently authenticated IDP is not guest, or SIWA(in Korea only)
        
  }
        else if 
  else if (
error
result.
code
GetCode() == 
KGErrorAlreadyUsedIdpAccount
FKGResultCode::AlreadyUsedIDPAccount)
  {
            
    // If trying to convert to an already used IDP account
        
  }
  else
        else 
  {
            
    // Other errors
        
  }
    
}
}]
));