# 第三方账户关联

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

&#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显示错误消息。
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gamepot.io/basics/gamepot-2.0/zhong-wen/unreal-sdk/di-san-fang-zhang-hu-guan-lian.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
