> For the complete documentation index, see [llms.txt](https://docs.gamepot.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gamepot.io/basics/gamepot-2.0/zhong-wen/unreal-sdk/di-san-fang-zhang-hu-guan-lian.md).

# 第三方账户关联

可以在一个游戏账户中关联或解除关联多个第三方账户。

&#x20;

## **账户关联功能** <a href="#zhang-hu-guan-lian-gong-neng" id="zhang-hu-guan-lian-gong-neng"></a>

***

如要使用Google、Facebook、NAVER等第三方账户的关联功能，请使用下列代码。

```
UENUM()
namespace ENLinkingType
{
    enum Type
    {
        NONE,
        GOOGLEPLAY,
        GAMECENTER,
        GOOGLE,
        FACEBOOK,
        NAVER,
        TWITTER,
        LINE,
        APPLE,
        THIRDPARTYSDK
    };
}

if (FGamePotSDKPluginModule::IsGamePotSdkAvailable())
    FGamePotSDKPluginModule::GetSharedGamePotSdk()->createLinking(ENLinkingType::Type linkingType);

void ASampleGameModeBase::OnCreateLinkingSuccess(FNUserInfo NUserInfo) {
        // 账户关联成功
}

void ASampleGameModeBase::OnCreateLinkingCancel() {
        // 玩家取消账户关联时

}
void ASampleGameModeBase::OnCreateLinkingFailure(FNError NError) {
        // 账户关联失败。请使用NError.message显示错误消息。
}
```

## **关联列表确认功能** <a href="#guan-lian-lie-biao-que-ren-gong-neng" id="guan-lian-lie-biao-que-ren-gong-neng"></a>

***

如要确认与账户关联的第三方账户列表，请使用下列代码。

```
if (FGamePotSDKPluginModule::IsGamePotSdkAvailable())
     TArray<FNLinkingInfo> linkedList = FGamePotSDKPluginModule::GetSharedGamePotSdk()->getLinkedList();


//定义链接信息
USTRUCT()
struct FNLinkingInfo
{
    UPROPERTY()
    ENLinkingType::Type provider;     // 账户关联信息（Google、FaceBook、NAVER、Apple…）
}
}
```

## **解除关联功能** <a href="#jie-chu-guan-lian-gong-neng" id="jie-chu-guan-lian-gong-neng"></a>

***

如要使用解除与第三方账户的关联功能，请使用下列代码。

```
if (FGamePotSDKPluginModule::IsGamePotSdkAvailable())
    FGamePotSDKPluginModule::GetSharedGamePotSdk()->deleteLinking(ENLinkingType::Type linkType);

void ASampleGameModeBase::OnDeleteLinkingSuccess() {
/// 账户关联解除成功
}

void ASampleGameModeBase::OnDeleteLinkingFailure(FNError NError) {
    /// 账户关联解除失败。请使用NError.message显示错误消息。
}
```
