> ## 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.

# XStoreGetUserCollectionsIdAsync

> XStoreGetUserCollectionsIdAsync

# XStoreGetUserCollectionsIdAsync

고객 컬렉션 ID를 가져옵니다. 그런 다음 이 ID를 사용하여 B2B 호출로 자체 서비스에서 사용자의 자격을 확인할 수 있습니다. 이 API는 [서비스에서 제품 관리](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/service-to-service/service-to-service-nav)에 설명된 흐름에서 사용됩니다.

## 구문

```cpp theme={null}
HRESULT XStoreGetUserCollectionsIdAsync(  
         const XStoreContextHandle storeContextHandle,  
         const char* serviceTicket,  
         const char* publisherUserId,  
         XAsyncBlock* async  
)  
```

### 매개 변수

*storeContextHandle*   \_In\_\
형식: XStoreContextHandle

[XStoreCreateContext](/reference/system/xstore/functions/xstorecreatecontext)가 반환한 사용자의 스토어 컨텍스트 핸들입니다.

*serviceTicket*   \_In\_z\_\
형식: char\*

백 엔드 서비스에서 사용자와 서비스를 승인하는 데 사용할 수 있는 Azure 티켓입니다. 이렇게 하면 서비스에서 티켓을 다시 받아 자체 서버에 릴레이할 수 있습니다. 그런 다음 서버는 이를 저장하고 B2B 호출에 사용하여 소유권을 확인하거나 액세스 권한을 부여할 수 있습니다.

*publisherUserId*   \_In\_z\_\
형식: char\*

게임, 개발자 또는 게시자에 속하는 서비스의 멤버 또는 게스트로 현재 사용자를 식별하기 위해 개발자가 생성한 문자열입니다. 이 문자열의 내용은 개발자가 결정하며 비워 둘 수 있습니다.

*async*   \_Inout\_\
형식: [XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

수행 중인 비동기 작업을 정의하는 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)입니다. [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)을 사용하여 호출의 상태를 폴링하고 호출 결과를 검색할 수 있습니다. 자세한 내용은 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)을 참조하세요.

### 반환 값

형식: HRESULT

HRESULT 성공 또는 오류 코드입니다.

## 설명

PC에서 이 API는 XBOX 서비스가 활성화된 경우 현재 스토어에 로그인한 사용자에 대한 정보를 반환하며 반드시 게임을 플레이하는 사용자에 대한 정보는 아닙니다. 타이틀이 XBOX 콘솔에 있거나 PC에서 XBOX 서비스가 활성화된 경우, XSTS 위임 권한 부여를 사용하여 컬렉션 및 라이선스 미리 보기 엔드포인트에 B2B 호출을 수행하여 활성 플레이 사용자에 대한 자격을 확인하는 것이 좋습니다.

사용자의 컬렉션 ID와 이 함수의 실행 결과를 검색하려면 이 함수를 호출한 후 [XStoreGetUserCollectionsIdResult](/reference/system/xstore/functions/xstoregetusercollectionsidresult)를 호출합니다. 사용자 컬렉션 ID의 크기를 검색하려면 [XStoreGetUserCollectionsIdResultSize](/reference/system/xstore/functions/xstoregetusercollectionsidresultsize)를 호출합니다. 결과의 크기를 알면 더 효율적으로 검색할 수 있습니다.

다음 코드 조각은 고객 컬렉션 ID를 검색하는 예를 보여 줍니다.

```cpp theme={null}
void CALLBACK GetUserCollectionsIdCallback(XAsyncBlock* asyncBlock)
{
    size_t size;
    HRESULT hr = XStoreGetUserCollectionsIdResultSize(
        asyncBlock,
        &size);

    if (FAILED(hr))
    {
        printf("Failed retrieve the user collection ID size: 0x%x\r\n", hr);
        return;
    }

    char* result = new char[size];
    hr = XStoreGetUserCollectionsIdResult(
        asyncBlock,
        size,
        result);

    if (FAILED(hr))
    {
        printf("Failed retrieve the user collection ID result: 0x%x\r\n", hr);
        delete[] result;
        return;
    }

    printf("result: %s\r\n", result);

    delete[] result;
}

void GetUserCollectionsId(XStoreContextHandle storeContextHandle, XTaskQueueHandle taskQueueHandle, const char* serviceTicket, const char* publisherUserId)
{
    auto asyncBlock = std::make_unique<XAsyncBlock>();
    ZeroMemory(asyncBlock.get(), sizeof(*asyncBlock));
    asyncBlock->queue = taskQueueHandle;
    asyncBlock->callback = GetUserCollectionsIdCallback;

    HRESULT hr = XStoreGetUserCollectionsIdAsync(
        storeContextHandle,
        serviceTicket,
        publisherUserId,
        asyncBlock.get());

    if (FAILED(hr))
    {
        printf("Failed to get user collections ID: 0x%x\r\n", hr);
        return;
    }
}
```

## 요구 사항

**헤더:** XStore.h(XGameRuntime.h에 포함됨)

**라이브러리:** xgameruntime.lib

**지원 플랫폼:** Windows, XBOX One 제품군 콘솔 및 XBOX Series 콘솔

## 개념 설명서

* [Requesting a User Store ID for service-to-service authentication](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/service-to-service/xstore-requesting-a-userstoreid)

## 참고 항목

[XStore](/reference/system/xstore/xstore_members)\
[XStoreGetUserCollectionsIdResult](/reference/system/xstore/functions/xstoregetusercollectionsidresult)\
[Manage products from your services](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/service-to-service/service-to-service-nav)


## Related topics

- [XStoreGetUserCollectionsIdResult](/ko/reference/system/xstore/functions/xstoregetusercollectionsidresult.md)
- [XStoreGetUserCollectionsIdResultSize](/ko/reference/system/xstore/functions/xstoregetusercollectionsidresultsize.md)
- [서비스 간 인증을 위한 User Store ID 요청](/ko/publishing/xstore-commerce/xstore-requesting-userstoreid.md)
- [XStore 커머스 개요](/ko/publishing/xstore-commerce/xstore-commerce-overview.md)
- [XStore](/ko/reference/system/xstore/xstore_members.md)
