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

# XUserGetTokenAndSignatureHttpHeader

> XUserGetTokenAndSignatureHttpHeader

# XUserGetTokenAndSignatureHttpHeader

웹 요청에 대한 HTTP 헤더를 지정합니다.

## 구문

```cpp theme={null}
typedef struct XUserGetTokenAndSignatureHttpHeader {  
    const char* name;  
    const char* value;  
} XUserGetTokenAndSignatureHttpHeader  
```

### 멤버

*name*\
형식: const char\*

헤더 이름입니다.

*value*\
형식: const char\*

헤더 값입니다.

## 설명

웹 요청에 대한 xtoken과 서명을 비동기적으로 검색하려면 [XUserGetTokenAndSignatureAsync](/reference/system/xuser/functions/xusergettokenandsignatureasync) 함수를 호출합니다.
이 함수는 XUserGetTokenAndSignatureHttpHeader 구조체에 대한 포인터를 인수로 사용합니다.

[XUserGetTokenAndSignatureAsync](/reference/system/xuser/functions/xusergettokenandsignatureasync) 호출 결과를 검색하려면 [XUserGetTokenAndSignatureResult](/reference/system/xuser/functions/xusergettokenandsignatureresult) 함수를 호출합니다.

다음 예제에서는 사용자의 토큰과 서명을 비동기적으로 검색하는 방법을 보여줍니다.

```cpp theme={null}
HRESULT RequestTokenComplete(XAsyncBlock* abResult)
{
    size_t bufferSize;
    RETURN_IF_FAILED(XUserGetTokenAndSignatureResultSize(abResult, &bufferSize));

    std::vector<uint8_t> buffer(bufferSize);
    XUserGetTokenAndSignatureData* data;
    if (SUCCEEDED_LOG(XUserGetTokenAndSignatureResult(abResult, buffer.size(), buffer.data(), &data, nullptr /*bufferUsed*/)))
    {
        appLog.AddLog("Token: %s\n", data->token);
        if (data->signature != nullptr)
        {    
            appLog.AddLog("Signature: %s\n", data->signature);
        }
    }

    return S_OK;
}

HRESULT RequestTokenAsync(
    XTaskQueueHandle queue,
    const char* url,
    bool forceRefresh)
{
    auto asyncBlock = std::make_unique<XAsyncBlock>();
    ZeroMemory(asyncBlock.get(), sizeof(*asyncBlock));
    asyncBlock->queue = queue;
    asyncBlock->context = this;
    asyncBlock->callback = [](XAsyncBlock* ab)
    {
        LOG_IF_FAILED(static_cast<User*>(ab->context)->RequestTokenComplete(ab));
        delete ab;
    };


    XUserGetTokenAndSignatureOptions options = XUserGetTokenAndSignatureOptions::None;

    if (forceRefresh)
    {
        WI_SET_FLAG(options, XUserGetTokenAndSignatureOptions::ForceRefresh);
    }

    static const XUserGetTokenAndSignatureHttpHeader headers[] =
    {
        { "Accept", "application/json"},
        { "Why", "Because"},
    };

    if (SUCCEEDED_LOG(XUserGetTokenAndSignatureAsync(
        _handle.get(),
        options,
        "GET",
        url,
        ARRAYSIZE(headers),
        headers,
        0,
        nullptr,
        asyncBlock.get())))
    {
        // The call succeeded, so release the std::unique_ptr ownership of XAsyncBlock* since the callback will take over ownership.
        // If the call fails, the std::unique_ptr will keep ownership and delete the XAsyncBlock*
        asyncBlock.release();
    }

    return S_OK;
}
```

## 요구 사항

**헤더:** XUser.h

**지원되는 플랫폼:** Windows, XBOX One 계열 콘솔 및 XBOX Series 콘솔

## 함께 보기

[XUser](/reference/system/xuser/xuser_members)

[XUserGetTokenAndSignatureAsync](/reference/system/xuser/functions/xusergettokenandsignatureasync)

[XUserGetTokenAndSignatureResult](/reference/system/xuser/functions/xusergettokenandsignatureresult)


## Related topics

- [XUserGetTokenAndSignatureAsync](/ko/reference/system/xuser/functions/xusergettokenandsignatureasync.md)
- [XUser](/ko/reference/system/xuser/xuser_members.md)
- [XUserGetTokenAndSignatureUtf16HttpHeader](/ko/reference/system/xuser/structs/xusergettokenandsignatureutf16httpheader.md)
- [XUserGetTokenAndSignatureUtf16Async](/ko/reference/system/xuser/functions/xusergettokenandsignatureutf16async.md)
- [XUserGetTokenAndSignatureOptions](/ko/reference/system/xuser/enums/xusergettokenandsignatureoptions.md)
