> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 타이틀 엔터티의 게임 서버

> PFAuthenticationGetEntityWithSecretKeyAsync를 사용하여 PlayFab Services SDK에서 타이틀 엔터티로 인증하고 Win32에서 서버 전용 API를 호출합니다.

# 타이틀 엔터티로 PlayFab 액세스

플레이어로 로그인하여 PlayFab 호출을 수행하는 것과 유사하게, 타이틀 엔터티로 인증하여 이를 통해 PlayFab 호출을 수행할 수도 있습니다. 타이틀 엔터티는 플레이어 엔터티에서 사용할 수 없는 특정 함수를 사용할 수 있습니다. 이러한 함수 중 다수는 "server"라는 단어로 시작하며, 그 예로 ServerAddPlayerTag가 있습니다.

타이틀 엔터티 핸들을 가져오는 초기화 단계는 플레이어로 로그인하는 것과 동일합니다. 자세한 내용은 [Win32용 빠른 시작](/services/playfab/sdks/c/quickstart-win32) 문서의 "초기화" 섹션을 참조하세요.

참고: 현재 서버 함수는 SDK의 Win32 버전에서만 사용할 수 있습니다.

## 타이틀 엔터티 인증

초기 단계에서 **PFServiceConfigHandle** 을 만든 후에는 [**PFAuthenticationGetEntityWithSecretKeyAsync**](/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationgetentitywithsecretkeyasync)를 호출하여 타이틀 엔터티 핸들을 가져올 수 있습니다. get entity 호출이 성공적으로 완료되면 **S\_OK** 와 **PFEntityHandle** 이 반환됩니다. 이 과정은 플레이어로 로그인하는 것과 유사합니다. **PFEntityHandle** 의 반환 형식은 동일하지만, 이 경우 엔터티 핸들은 플레이어 엔터티가 아닌 타이틀 엔터티를 나타냅니다. 이 엔터티를 게임 서버라고 부를 수 있습니다.

```cpp theme={null}
    PFAuthenticationGetEntityRequest request{};
    XAsyncBlock async{};

    // Add your own error handling when FAILED(hr) == true
    HRESULT hr = PFAuthenticationGetEntityWithSecretKeyAsync(
        serviceConfigHandle,
        secretKey, // title specific secret key
        &request,
        &async
    );

    hr = XAsyncGetStatus(&async, true); // This is doing a blocking wait for completion, but you can use the XAsyncBlock to set a callback instead for async style usage

    PFEntityHandle entityHandle;
    hr = PFAuthenticationGetEntityWithSecretKeyGetResult(
        &async,
        &entityHandle
    );
```

## 서비스 호출

게임 서버가 만들어지면 PlayFab 백엔드에 호출을 수행할 수 있습니다. 다음은 타이틀의 특정 플레이어에게 플레이어 태그를 추가하는 예제입니다.

```cpp theme={null}
    XAsyncBlock async{};
    PFSegmentsAddPlayerTagRequest request{};
    addSegmentRequest.PlayFabId = "ABCDEF123456";
    addSegmentRequest.tagName = "tagName";
    HRESULT hr = PFSegmentsServerAddPlayerTagAsync(entityHandle, &request, &async);
    hr = XAsyncGetStatus(&async, true);
```

AddPlayerTag 예제와 마찬가지로 게임 서버에서 사용하는 함수 중 다수는 플레이어 데이터를 가져오거나 변경하는 작업을 포함합니다. 이 함수는 특정 플레이어의 PlayFab ID를 필요로 합니다. 연결된 클라이언트가 PlayFab ID를 제공하거나, 서버가 GetPlayFabIDsFromXboxLiveIDs와 같은 호출을 통해 PlayFab에서 직접 검색할 수 있습니다.

## 참조

[API 참조 설명서](/services/playfab/api-references/c/pfauthentication/pfauthentication_members)


## Related topics

- [엔터티 핸들](/ko/services/playfab/sdks/c/entity-handles.md)
- [엔터티 파일](/ko/services/playfab/live-service-management/game-configuration/entities/entity-files.md)
- [사용 가능한 기본 제공 엔터티 유형](/ko/services/playfab/live-service-management/game-configuration/entities/available-built-in-entity-types.md)
- [엔터티 빠른 시작](/ko/services/playfab/live-service-management/game-configuration/entities/quickstart.md)
- [엔터티 오브젝트를 사용하여 플레이어 데이터 저장](/ko/services/playfab/live-service-management/game-configuration/entities/entity-objects.md)
