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

# XGameUiShowWebAuthenticationWithOptionsAsync

> XGameUiShowWebAuthenticationWithOptionsAsync

# XGameUiShowWebAuthenticationWithOptionsAsync

사용자가 실행 중인 타이틀에 자격 증명을 직접 제공하지 않고도 외부 웹 사이트 및 서비스에 대한 액세스를 위임할 수 있도록, 필요 시 전체 화면으로 표시할 수 있는 웹 UI를 표시하는 비동기 인증 요청을 시작합니다.

## 구문

```cpp theme={null}
STDAPI XGameUiShowWebAuthenticationWithOptionsAsync(
    _In_ XAsyncBlock* async,
    _In_ XUserHandle requestingUser,
    _In_z_ const char* requestUri,
    _In_z_ const char* completionUri,
    _In_ XGameUiWebAuthenticationOptions options
    ) noexcept;
)  
```

### 매개 변수

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

[XAsyncRun](/reference/system/xasync/functions/xasyncrun)에 전달되는 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)에 대한 포인터입니다.

*requestingUser*   \_In\_\
형식: XUserHandle

웹 인증을 요청하는 사용자에 대한 핸들입니다.

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

사용자에게 표시되는 웹 뷰의 초기 URI입니다(일반적으로 서비스에 대한 사용자 인증 필드가 포함됨). 요청 URI는 안전한 HTTPS 주소여야 합니다.

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

웹 인증 프로세스의 성공적인 완료를 나타내는 URI를 지정합니다. 웹 뷰가 *completionUri*와 일치하는 URI로 이동하면 웹 뷰가 닫히고 제어권이 호출 타이틀로 반환됩니다.

*options* \&nbps; \_In\_
형식: [XGameUiWebAuthenticationOptions](/reference/system/xgameui/enums/xgameuiwebauthenticationoptions)

UI를 전체 화면으로 표시할지 여부를 나타내는 플래그입니다. PC에서는 이 플래그가 무시됩니다. 전체 화면은
PC에서 지원되는 옵션이 아닙니다.

### 반환 값

형식: HRESULT

비동기 호출의 HRESULT 성공 또는 오류 코드입니다.

결과를 가져오려면 *AsyncBlock* 콜백 내부 또는 *AsyncBlock* 완료 후 [xgameuishowwebauthenticationresultsize](/reference/system/xgameui/functions/xgameuishowwebauthenticationresultsize) 및 [xgameuishowwebauthenticationresult](/reference/system/xgameui/functions/xgameuishowwebauthenticationresult)를 호출하세요.

## 설명

이 비동기 작업이 실행되면 시스템은 사용자에게 웹 뷰를 표시하며(현재 애플리케이션을 오버레이함), 사용자는 이와 상호 작용하거나 뒤로 버튼을 눌러 닫을 수 있습니다. 이를 통해 사용자는 OAuth를 사용하여 외부 웹 사이트 및 서비스에 대한 권한 부여를 승인할 수 있습니다. 이는 소셜 미디어에서 게임 하이라이트를 공유하기 위한 게임 인증, 외부 공급자로부터의 사용자 데이터 요청 등의 시나리오에서 사용할 수 있습니다.

인증 요청의 결과는 [XGameUiShowWebAuthenticationResult](/reference/system/xgameui/functions/xgameuishowwebauthenticationresult) 메서드에서 반환되는 [XGameUiWebAuthenticationResultData](/reference/system/xgameui/structs/xgameuiwebauthenticationresultdata) 객체에 저장됩니다.

*completionUri*로의 이동 결과로 웹 뷰가 닫힌 경우, 결과 데이터 구조체의 *responseStatus* 필드는 `S_OK`가 됩니다.

사용자가 웹 뷰를 취소하거나 수동으로 닫는 경우, 결과 데이터 구조체의 *responseStatus* 필드는 `E_CANCELLED`가 됩니다.

## 예제

다음 코드 예제는 Facebook을 사용하여 OAuth를 수행하는 방법을 보여 줍니다. 이 예제에는 코드를 간결하게 유지하기 위해 메모리 할당 오류 처리가 포함되지 않았습니다.

```cpp theme={null}
// Use Facebook example for OAuth; client_id should correspond to your registered application.
const char completionUri[] = "https://www.facebook.com/connect/login_success.html"; 
const char requestUri[] =
    "https://www.facebook.com/dialog/oauth?"
    "client_id=000000000000000&"
    "redirect_uri=https%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success.html&"
    "response_type=token&"
    "sdk=xboxone";

// Allocate and initialize XAsyncBlock for asynchronous authentication operation.
XAsyncBlock* block = new XAsyncBlock();
ZeroMemory(block, sizeof(XAsyncBlock));
block->callback = [](XAsyncBlock* block)
{
    // Query required size and allocate buffer for authentication result data.
    uint32_t bufferSize = 0;
    FAIL_FAST_IF_FAILED(XGameUiShowWebAuthenticationResultSize(block, &bufferSize));
    uint8_t* buffer = new uint8_t[bufferSize];

    // The currentUser is initialized with user to authenticate for.
    XGameUiWebAuthenticationResultData* resultData = nullptr;
    FAIL_FAST_IF_FAILED(XGameUiShowWebAuthenticationResult(
        block,
        bufferSize,
        buffer,
        &resultData,
        nullptr
        ));

    //
    // Use the result data here. If resultData->responseStatus is S_OK, then web authentication was successful.
    //

    // Free allocated buffer and XAsyncBlock.
    delete[] buffer;
    delete block;
};

//  Begin asynchronous authentication operation.
XUserHandle currentUser = GetCurrentUserForAuthentication();
FAIL_FAST_IF_FAILED(XGameUiShowWebAuthenticationWithOptionsAsync(
    block,
    currentUser,
    requestUri,
    completionUri,
    XGameUiWebAuthenticationOptions::PreferFullscreen
    ));
```

## 요구 사항

**헤더:** XGameUI.h

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

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

## 함께 보기

[XGameUI](/reference/system/xgameui/xgameui_members)
[XGameUiShowWebAuthenticationAsync](/reference/system/xgameui/functions/xgameuishowwebauthenticationasync)\
[XGameUiShowWebAuthenticationResultSize](/reference/system/xgameui/functions/xgameuishowwebauthenticationresultsize)\
[XGameUiShowWebAuthenticationResult](/reference/system/xgameui/functions/xgameuishowwebauthenticationresult)\
[XGameUiWebAuthenticationResultData](/reference/system/xgameui/structs/xgameuiwebauthenticationresultdata)\
[비동기 프로그래밍 모델](/build/core-features/common/async/async-programming-model)


## Related topics

- [XGameUiWebAuthenticationOptions](/ko/reference/system/xgameui/enums/xgameuiwebauthenticationoptions.md)
- [XGameUiShowWebAuthenticationAsync](/ko/reference/system/xgameui/functions/xgameuishowwebauthenticationasync.md)
- [XGameUI](/ko/reference/system/xgameui/xgameui_members.md)
- [XGameUiShowWebAuthenticationResult](/ko/reference/system/xgameui/functions/xgameuishowwebauthenticationresult.md)
- [XGameUiShowWebAuthenticationResultSize](/ko/reference/system/xgameui/functions/xgameuishowwebauthenticationresultsize.md)
