버전 비교

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

5.1. Connect Account Example

목차
minLevel1
maxLevel7

...

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.

    Image Modified
  • 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.

...

코드 블럭
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 (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
KGIdpProfile.KGIdpCode idpCode; // IDP to be used for account connection
 
KGSessionForCustomUI.connect(activity, idpCode, 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
            }
        }
    }
});

...