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

# XUserGetTokenAndSignatureUtf16Async

> XUserGetTokenAndSignatureUtf16Async

# XUserGetTokenAndSignatureUtf16Async

API that asynchronously retrieves the X-token and Signature required to authorize an HTTPS call to the target URL. This will return an X-token and Signature if there is a Relying Party tied to the target URL in the title’s [Single Sign-on page in Partner Center](/services/xbox-services/fundamentals/s2s-auth-calls/custom-service-config/single-sign-on/live-single-sign-on). Add the X-token and Signature values from the [Results version of the API](/reference/system/xuser/functions/xusergettokenandsignatureutf16result) to the Authorization and Signature headers of the HTTPS call before making the request.

## Syntax

```cpp theme={null}
HRESULT XUserGetTokenAndSignatureUtf16Async(  
         XUserHandle user,  
         XUserGetTokenAndSignatureOptions options,  
         const wchar_t* method,  
         const wchar_t* url,  
         size_t headerCount,  
         const XUserGetTokenAndSignatureUtf16HttpHeader* headers,  
         size_t bodySize,  
         const void* bodyBuffer,  
         XAsyncBlock* async  
)  
```

### Parameters

*user*   \_In\_\
Type: XUserHandle

A handle to the user that the web request is for.

*options*   \_In\_\
Type: [XUserGetTokenAndSignatureOptions](/reference/system/xuser/enums/xusergettokenandsignatureoptions)

Options for retrieving the user token and signature.

*method*   \_In\_z\_\
Type: wchar\_t\*

The method type for the web request, in Unicode.

*url*   \_In\_z\_\
Type: wchar\_t\*

The target URL of your HTTPS request. Use the full URL string for the HTTPS request. Don't abbreviate the URL.

*headerCount*   \_In\_\
Type: size\_t

The number of headers in the *headers* parameter.

*headers*   \_In\_reads\_opt\_(headerCount)\
Type: [XUserGetTokenAndSignatureUtf16HttpHeader\*](/reference/system/xuser/structs/xusergettokenandsignatureutf16httpheader)

Headers for the web request.

*bodySize*   \_In\_\
Type: size\_t

The size of the buffer in the *bodyBuffer* parameter.

*bodyBuffer*   \_In\_reads\_bytes\_opt\_(bodySize)\
Type: void\*

A buffer that contains the body of the web request.

*async*   \_Inout\_\
Type: XAsyncBlock\*

An [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) for polling the call's status and retrieving call results.

### Return value

Type: HRESULT

Returns S\_OK if successful; otherwise, returns an error code.
For a list of error codes, see [Error Codes](/reference/errorcodes).

## Remarks

The XUserGetTokenAndSignatureUtf16Async function uses an [XUserGetTokenAndSignatureOptions](/reference/system/xuser/enums/xusergettokenandsignatureoptions) enumeration argument to asynchronously retrieve unicode X-tokens and Signatures for web requests.

To retrieve the result of calling XUserGetTokenAndSignatureUtf16Async, call [XUserGetTokenAndSignatureUtf16Result](/reference/system/xuser/functions/xusergettokenandsignatureutf16result).

To retrieve the required buffer size to hold the results of calling XUserGetTokenAndSignatureUtf16Async, call [XUserGetTokenAndSignatureUtf16ResultSize](/reference/system/xuser/functions/xusergettokenandsignatureutf16resultsize).

## Requirements

**Header:** XUser.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, Steam Deck, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

* [WinHTTP overview](/build/console-features/networking/web-requests/intro-winhttp)
* [Implement player sign in](/services/xbox-services/playfab-integration)

## See also

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

[XUserGetTokenAndSignatureUtf16Result](/reference/system/xuser/functions/xusergettokenandsignatureutf16result)

[XUserGetTokenAndSignatureUtf16ResultSize](/reference/system/xuser/functions/xusergettokenandsignatureutf16resultsize)


## Related topics

- [XUserGetTokenAndSignatureUtf16Result](/reference/system/xuser/functions/xusergettokenandsignatureutf16result.md)
- [XUserGetTokenAndSignatureUtf16ResultSize](/reference/system/xuser/functions/xusergettokenandsignatureutf16resultsize.md)
- [XUserGetTokenAndSignatureUtf16Data](/reference/system/xuser/structs/xusergettokenandsignatureutf16data.md)
- [XUserGetTokenAndSignatureUtf16HttpHeader](/reference/system/xuser/structs/xusergettokenandsignatureutf16httpheader.md)
- [XUserGetTokenAndSignatureOptions](/reference/system/xuser/enums/xusergettokenandsignatureoptions.md)
